只有极限情况会爆unsigned long long
#include<cstdio> using namespace std; int t,x; unsigned long long ans,y; int main() { scanf("%d",&t); for (int i=1;i<=t;i++) { ans=0; for (int j=1;j<=8;j++) { scanf("%d",&x); ans+=(1LL<<x); } scanf("%llu",&y); if ((ans==(1LL<<63)) && (y==ans)) printf("18446744073709551616\n"); else printf("%llu\n",ans+y); } return 0; }