fork download
  1. #include<iostream>
  2. using namespace std;
  3. #define m 1000000007
  4. int main()
  5. { long long int a;
  6. int c,t;
  7. long long int n;
  8. cin>>t;
  9. while(t--)
  10. { a=2;c=1;
  11. cin>>n;
  12.  
  13. for(int i=2;i<=n;i++)
  14. {if(i%2==0)
  15. c=(c<<1)%m;
  16. a=(a+c)%m;
  17. }
  18. cout<<a<<endl;
  19. }
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 2728KB
stdin
5
1
2
3
4
5
stdout
2
4
6
10
14