fork(1) download
  1. #include <iostream>
  2. #define max 1000000007
  3. using namespace std;
  4.  
  5. int schemes(int n) {
  6. int a[n+1];
  7. a[1]=0;a[2]=12;
  8. for(int i=3;i<=(max-7);++i) {
  9. a[i]=(2*a[i-1])%max+(3*a[i-2])%max;
  10. a[i]%=max;
  11. }
  12. return a[n];
  13. }
  14.  
  15. int main() {
  16. ios::sync_with_stdio(false);
  17. int t,n;
  18. cin>>t;
  19. while(t--) {
  20. cin>>n;
  21. cout<<schemes(n)<<endl;
  22. }
  23. return 0;
  24. }
Runtime error #stdin #stdout 0s 3476KB
stdin
3
2
3
5
stdout
Standard output is empty