题目
1763. Gift (Standard IO)
Time Limits: 1000 ms Memory Limits: 1024 KB Detailed Limits
分析
- unsigned long long 开不开高精都可以
代码
#include<cstdio> using namespace std; typedef long long ll; typedef unsigned long long ull; int a,b,c,d,e,f,g,h; ull ans; ull tmp; ull i; #define rep(x,y,z) for(int i=(x);i<=(y);i+=(z)) int main() { int cas; ull com=((ull)9223372036*(ull)1000000000)+(ull)854775808; scanf("%d",&cas); while(cas--) { ans=0; scanf("%d%d%d%d%d%d%d%d%llu",&a,&b,&c,&d,&e,&f,&g,&h,&i); if(a==60&&b==60&&c==60&&d==60&&e==60&&f==60&&g==60&&h==60&&i==com) printf("18446744073709551616 "); else { tmp=1; ans+=(ull)i; for (int k=1;k<=a;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=b;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=c;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=d;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=e;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=f;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=g;k++) tmp*=(ull)2; ans+=tmp;tmp=1; for (int k=1;k<=h;k++) tmp*=(ull)2; ans+=tmp;tmp=1; printf("%llu ",ans); } } return 0; }