結果
問題 | No.1664 Unstable f(n) |
ユーザー |
|
提出日時 | 2022-08-28 23:08:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 2,107 ms |
コンパイル使用メモリ | 193,932 KB |
最終ジャッジ日時 | 2025-02-06 23:21:03 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ll n; std::cin >> n; ll ans = n; for (int j = 1; j <= 59; j++) { ll i = floor(powl(n,(ld)(1.0/(ld)j))+0.00000000000001); // std::cout << i << std::endl; ans = min(ans, i+j+(ll)(n-powl(i,j))); } std::cout << ans << std::endl; }