Bzoj2056gift? High accuracy?
Test instructions
Give Abcdefghi, Beg 2^a+2^b+2^c+2^d+2^e+2^f+2^g+2^h+i. a~h≤60,i≤2^63
Exercises
Found only the limit data will explode unsigned long long, so let i-1, and then add them up, found that this data is the limit data personal overdraft calculate 2^64 output string, otherwise directly +1 can.
Note that when you calculate the n power of 2 to 1LL<<n, and unsigned long long output to%llu.
Code:
1#include <cstdio>2#include <cstring>3#include <algorithm>4 #defineInc (I,J,K) for (int i=j;i<=k;i++)5 using namespacestd;6 7UnsignedLong Longa[Ten];intT;8 intMain () {9scanf"%d",&t);Ten while(t--){ OneInc (I,0,8) scanf ("%llu", &a[i]); a[9]=0; A if(a[8]==0){ -Inc (I,0,7) a[9]+= (1ll<<a[i]); printf"%llu\n", a[9]); -}Else{ thea[8]--; Inc (I,0,7) a[9]+= (1ll<<a[i]); a[9]+=a[8]; - if(a[9]==18446744073709551615) printf ("18446744073709551616\n");Elseprintf"%llu\n", a[9]+1); - } - } + return 0; -}
20160810
Bzoj2056gift? High accuracy? *