Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <algorithm>
  3. #include <fstream>
  4. #include <iterator>
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main(void)
  10. {
  11. /* ifstream fin ("small-powers.in");
  12. ofstream fout ("small-powers.out");*/
  13.  
  14. vector <int> v(26);
  15. int n, k, x;
  16. cin>>n;
  17. k=n;
  18. x=n;
  19. if (n==1) {
  20. cout<<1;
  21. return 0;}
  22. else {
  23. cout<<1;
  24. generate(v.begin(), v.end(), [&] ()
  25. {cout<<x<<" ";
  26. if (x<=1e9 && long long(x*x) >= x)
  27. x = x*k;
  28. else
  29. x = 0;
  30. return x;
  31. });
  32.  
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement