人生有信仰 数据有梯度 暴力不爆零


bzoj 2056: gift? 高精度?

2056: gift? 高精度?

Time Limit: 10 Sec  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

Sample Output

3223322629

HINT

 
【数据规模】
40% t<=1000
100% t<=100000 a,b,c,d,e,f,g,h<=60 i<=9223372036854775808

Source

#include<cstdio>
#define ull unsigned long long
ull s,tmp;
int t,a[10];
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        s=0;
        for(int i=0;i<8;i++) scanf("%d",&a[i]);
        scanf("%llu",&tmp);
        for(int i=0;i<8;i++) s+=(1LL<<a[i]);
        if(s!=1LL<<63||tmp!=s) printf("%llu\n",s+tmp);
        else puts("18446744073709551616");
    }
}

 

posted @ 2017-01-12 21:17  lkhll  阅读(496)  评论(0编辑  收藏  举报