标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 1476 Accepted Submission(s): 726
1 #include <stdio.h> 2 #include <string.h> 3 using namespace std; 4 long long mod=1000000007; 5 6 long long pow_mod(long long x, long long n) { 7 long long res = 1; 8 while (n) { 9 if (n & 1) res = res * x % mod; 10 x = x * x % mod; 11 n >>= 1; 12 } 13 return res; 14 } 15 16 int main() 17 { 18 int T; 19 long long n; 20 scanf("%d",&T); 21 while(T--) 22 { 23 scanf("%I64d",&n); 24 printf ("%I64d\n", pow_mod (2, n - 1) - 1); 25 } 26 return 0; 27 }
标签:
原文地址:http://www.cnblogs.com/cyd308/p/4771386.html