Advertisement
Saleh127

UVA 4721

Sep 22nd, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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 fiv[100];
  12. ll i,j,k,l,c,d,e;
  13. vector<ll>a;
  14. fiv[0]=1;
  15. fiv[1]=1;
  16. for(i=2; i<=92; i++)
  17. {
  18. fiv[i]=fiv[i-1]+fiv[i-2];
  19. }
  20.  
  21. while(cin>>c)
  22. {
  23. d=c;
  24. a.clear();
  25. for(i=91; i>=0 && c>0; i--)
  26. {
  27. if(fiv[i]<=c)
  28. {
  29. while(fiv[i]<=c)
  30. {
  31. a.push_back(i);
  32. c-=fiv[i];
  33. }
  34. }
  35. }
  36. cout<<d<<endl;
  37. for(i=0; i<a.size(); i++)
  38. {
  39. cout<<a[i]<<" ";
  40. }
  41. cout<<endl;
  42. for(i=0; i<a.size(); i++)
  43. {
  44. cout<<fiv[a[i]]<<" ";
  45. }
  46. cout<<endl;
  47. cout<<endl;
  48. }
  49.  
  50. return 0;
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement