結果
| 問題 |
No.1664 Unstable f(n)
|
| コンテスト | |
| ユーザー |
shiroha_F14
|
| 提出日時 | 2021-07-29 19:31:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 397 bytes |
| コンパイル時間 | 1,688 ms |
| コンパイル使用メモリ | 166,408 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-15 08:47:00 |
| 合計ジャッジ時間 | 2,959 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll n; cin >> n;
if(n < 4LL){
cout << n << endl;
}else{
ll ans = LLONG_MAX;
for(ll j = 2; j <= log2(n); j++){
ll i = pow(n, 1.0 / j);
// fix error of i
while(pow(i + 1, j) <= n) i++;
ll k = n - pow(i, j);
ans = min(ans, i + j + k);
}
cout << ans << endl;
}
}
shiroha_F14