高精度(滑稽
我们发现,只有极限数据爆unsigned long long ,特判一下即可。
#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;
}