Saleh127

UVA 900

Jul 27th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. ll a[500],c,d,i,j,k;
  10. a[1]=1;
  11. a[2]=2;
  12. for(i=3;i<=50;i++)
  13. {
  14. a[i]=a[i-1]+a[i-2];
  15. }
  16. while(cin>>c &&c)
  17. {
  18. cout<<a[c]<<endl;
  19. }
  20. return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment