#include #include #include #include #include #include #define fio(fn) freopen(fn".in", "r", stdin), freopen(fn".out", "w", stdout) using namespace std; using ll = long long; ll n, x, y; // chr_count, clipboard = time //ll f[7005][7005]; int main() { // fio("dice"); ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); // memset(f, 0x3f, sizeof f); // f[1][0] = 0; cin >> x >> y >> n; // n++; if (n == 1) { cout << "0\n"; return 0; } ll ans = 0x3f3f3f3f3f3f3f3fll; for (int i = 1; ; i++) { ll a = floor(pow(n, 1. / i)), b = ceil(pow(n, 1. / i)); vector pwra(i + 1), pwrb(i + 1); pwra[0] = pwrb[0] = 1; for (int j = 1; j <= i; j++) { pwra[j] = pwra[j - 1] * a; pwrb[j] = pwrb[j - 1] * b; } // 边界修正 for (int j = 0; j <= i; j++) { if (pwra[j] * pwrb[i - j] >= n) { ans = min(ans, (x + y * (a - 1)) * j + (x + y * (b - 1)) * (i - j) ); } } if (b <= 2) break; } cout << ans << '\n'; }