/* -*- coding: utf-8 -*- * * 376.cc: No.376 立方体のN等分 (2) - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ typedef long long ll; const ll LINF = 1LL << 60; /* typedef */ typedef vector vl; /* global variables */ vl v0; /* subroutines */ /* main */ int main() { ll n; cin >> n; for (ll a = 1; a * a <= n; a++) if (n % a == 0) v0.push_back(a); int vn = v0.size(); //printf("%d\n", vn); ll mint = LINF, maxt = 0; for (int i = 0; i < vn; i++) { ll &a = v0[i]; for (int j = i; j < vn; j++) { ll &b = v0[j], ab = a * b; if (n % ab == 0) { ll c = n / ab; if (c >= b) { ll t = a + b + c - 3; if (mint > t) mint = t; if (maxt < t) maxt = t; } } } } printf("%lld %lld\n", mint, maxt); return 0; }