Saleh127

UVA 11310

Sep 23rd, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ll f[45],i,j,k,l,a,c;
  8. f[0]=1;
  9. f[1]=1;
  10. f[2]=5;
  11. for(i=3;i<=40;i++)
  12. {
  13. f[i]=f[i-1]+(4*f[i-2])+(2*f[i-3]);
  14. }
  15. test
  16. {
  17. cin>>a;
  18. cout<<f[a]<<endl;
  19. }
  20. }
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment