SHARE
TWEET

Untitled

a guest Sep 17th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define TASK "small-powers"
  6. vector<int64_t> v(35, -1);
  7. int64_t n = 1;
  8. int64_t f = n;
  9.  
  10. int fn1(int64_t i)
  11. {
  12.     if(f*n <= 1e9 && f*n > 0)
  13.     {
  14.         f = f*n;
  15.         return f;
  16.     }
  17.     return 0;
  18. }
  19. int fn2(int64_t i)
  20. {
  21.     if(i <= 1e9 && i != -1 && i > 0)
  22.         cout << i << " ";
  23.     return 0;
  24. }
  25.  
  26. int32_t main()
  27. {
  28.     freopen(TASK".in", "r", stdin);
  29.     freopen(TASK".out", "w", stdout);
  30.  
  31.     cin >> n;
  32.     cout << 1 << " ";
  33.     if(n == 1)
  34.         return 0;
  35.     v[0] = n;
  36.     transform(v.begin(), v.end(), v.begin(), fn1);
  37.     transform(v.begin(), v.end(), v.begin(), fn2);
  38.  
  39.     return 0;
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top