// http://www.spoj.com/problems/GOPI_SW/
#include<stdio.h>
long long arr[1000006];
void solution(){
long i;
arr[2]=2;
for(i=3;i<=1000000;i++){
arr[i]=(arr[i-1]*(arr[i-1]+1))%1000000007;
}
}
int main(){
solution();
long long t,n;
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
printf("%lld\n",arr[n]%1000000007);
}
return 0;
}
#include<stdio.h>
long long arr[1000006];
void solution(){
long i;
arr[2]=2;
for(i=3;i<=1000000;i++){
arr[i]=(arr[i-1]*(arr[i-1]+1))%1000000007;
}
}
int main(){
solution();
long long t,n;
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
printf("%lld\n",arr[n]%1000000007);
}
return 0;
}
No comments:
Post a Comment