Memory Limit: 1 MB
Description
Input
输入的第一行为一个整数t。 接下来t行,每行包含九个自然数。
Output
输出t行 每行一个整数,表示2^a+2^b+2^c+2^d+2^e+2^f+2^g+2^h+i。
Sample Input
1
21 30 0 0 0 0 0 0 2147483647
21 30 0 0 0 0 0 0 2147483647
Sample Output
3223322629
【数据规模】
40% t<=1000
100% t<=100000 a,b,c,d,e,f,g,h<=60 i<=9223372036854775808
【数据规模】
40% t<=1000
100% t<=100000 a,b,c,d,e,f,g,h<=60 i<=9223372036854775808
这题什么鬼...
#include<cstdio>
using namespace std;
int main()
{
int T;
scanf("%d",&T);
while(T>0)
{
T--;
unsigned long long a,b,c,d,e,f,g,h,i;
unsigned long long lim=(unsigned long long)9223372036*(unsigned long long)1000000000+(unsigned long long)854775808;
scanf("%llu%llu%llu%llu%llu%llu%llu%llu%llu",&a,&b,&c,&d,&e,&f,&g,&h,&i);
if(a+b+c+d+e+f+g+h==60*8&&i==lim)
printf("18446744073709551616\n");
else
{
unsigned long long ans=i,t=1;
for(i=1;i<=a;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=b;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=c;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=d;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=e;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=f;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=g;i++)
t*=(unsigned long long)2;
ans+=t;
t=1;
for(i=1;i<=h;i++)
t*=(unsigned long long)2;
ans+=t;
printf("%llu\n",ans);
}
}
return 0;
}