1 #include<cstdio> 2 __int64 f(__int64 a) 3 { 4 __int64 b=2; 5 __int64 t=1; 6 while(a) 7 { 8 if(a % 2 != 0) 9 { 10 t=(t*b)%1000000007; 11 } 12 b=b*b%1000000007; 13 a/=2; 14 } 15 return t; 16 } 17 int main() 18 { 19 int t; 20 scanf("%d",&t); 21 while(t--) 22 { 23 __int64 n; 24 scanf("%I64d",&n); 25 printf("%I64d\n",f(n-1)-1); 26 } 27 28 }
原文:http://www.cnblogs.com/yexiaozi/p/5698313.html