結果
| 問題 |
No.1664 Unstable f(n)
|
| コンテスト | |
| ユーザー |
shiroha_F14
|
| 提出日時 | 2021-07-29 19:31:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 434 bytes |
| コンパイル時間 | 1,490 ms |
| コンパイル使用メモリ | 166,336 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-15 08:46:53 |
| 合計ジャッジ時間 | 2,705 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 3 WA * 35 |
ソースコード
#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 << i << " " << j << endl;
}
cout << ans << endl;
}
}
shiroha_F14