bzoj2056 gift? 高精度?

题目

高精度(滑稽

我们发现,只有极限数据爆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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值