ABC097B - Exponential
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main(void){ int x, ans = 1; cin.tie(0); ios::sync_with_stdio(false); cin >> x; for (int b = 2; b <= x; ++b) { for (int p = 2; (int)pow((double)b, (double)p) <= x; ++p) { ans = max(ans, (int)pow((double)b, (double)p)); } } cout << ans << "\n"; return 0; }