Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 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. long long 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<<" " << x << " ";
  24. generate(v.begin(), v.end(), [&] ()
  25. {
  26. if (k*x<=1e9 && k*x > 0)
  27. {
  28. x = x*k;
  29. cout<<x<<" ";
  30. }
  31. else
  32. x = 0;
  33. return x;
  34. });
  35.  
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement