Guest User

Untitled

a guest
Oct 21st, 2019
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int f[10001],i,n,k;
  5. int main()
  6. { cin>>n;
  7. f[1]=1;k=1;
  8. for(k=2;f[k-1]<n;k++)
  9. if(k%2==0)
  10. f[k]=1+f[k-1];
  11. else
  12. f[k]=1+2*f[k-2];
  13. for(i=k-1;i>=1;i--)
  14. cout<<f[i]<<" ";
  15. return 0;
  16. }
RAW Paste Data