4 1 2 3 4
0 1 3 7
//#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cmath> #include<stdlib.h> #include<map> #include<set> #include<time.h> #include<vector> #include<queue> #include<string> #include<string.h> #include<iostream> #include<algorithm> using namespace std; #define eps 1e-8 #define INF 0x3f3f3f3f #define LL long long #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) typedef pair<int , int> P; #define mod 1000000007 int main() { int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); int ans = 1; int a = 2; n--; while(n) { if(n & 1) ans = ((LL)ans * a) % mod; a = ((LL)a * a) % mod; n >>= 1; } ans--; printf("%d\n", ans % mod); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/dojintian/article/details/47322089