#include #include #include #include #include #include #include #include using namespace std; vector get_yakusu(long long n) { set yakusu_set; long long limit = sqrt(n); for (long long i = 1; i <= limit; i++) { if (n % i == 0) { yakusu_set.insert(i); yakusu_set.insert(n / i); } } vector yakusu(yakusu_set.begin(), yakusu_set.end()); return yakusu; } int main() { long long n; cin >> n; long long tmin, tmax; tmax = n - 1; tmin = tmax; auto yakusu = get_yakusu(n); int len = yakusu.size(); long long x, y, z; for (int i = 0; i < len; i++) { x = yakusu[i]; for (int j = 0; j < len; j++) { y = yakusu[j]; z = n / x / y; if (z == 0) { continue; } tmin = min(tmin, x + y + z - 3); } } cout << tmin << " " << tmax << endl; return 0; }