Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define pb push_back
- #define pii pair<int, int>
- #define pll pair<ll, ll>
- #define el endl
- #define umi unordered_map<int, int>
- #define umll unordered_map<ll, ll>
- #define all(vect) vect.begin(), vect.end()
- #define reset(A, x) memset(A, x, sizeof(A))
- #define approx(n) fixed << setprecision(n)
- using namespace std;
- const int mod = 1e9 + 7;
- int log_a_to_base_b(int a, int b)
- {
- return int(log2(a) / log2(b));
- }
- void solve() {
- int n;
- cin >> n;
- int maxx = 0;
- for(int i = 2; i < n; i++) {
- int te = log_a_to_base_b(n, i);
- int p = pow(i, te);
- if(p > maxx && p <= n) {
- maxx = p;
- }
- }
- cout << maxx << el;
- }
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int t = 1;
- // cin >> t;
- // cin.ignore();
- while (t--) {
- solve();
- }
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement