Saleh127

UVA 11069

Nov 18th, 2020 (edited)
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 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. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11. ll dp[1000];
  12. ll a,b,i,j,k,l;
  13. dp[0]=0;
  14. dp[1]=1;
  15. dp[2]=2;
  16. dp[3]=2;
  17. for(i=4; i<=76; i++)
  18. {
  19. dp[i]=dp[i-2]+dp[i-3];
  20. }
  21. while(cin>>a)
  22. {
  23. cout<<dp[a]<<endl;
  24. }
  25.  
  26. return 0;
  27. }
  28. //1
  29. //1,2....1..2
  30. //1,2,3...1,3...2
  31. ///1,2,3,4...1,3..2,4..1,4
  32. ///1,2,3,4,5...1,3,5..2,4..2,5..1,4
Add Comment
Please, Sign In to add comment