結果
| 問題 | No.1664 Unstable f(n) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-27 22:54:32 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 424 bytes |
| 記録 | |
| コンパイル時間 | 852 ms |
| コンパイル使用メモリ | 96,996 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-06-27 06:02:31 |
| 合計ジャッジ時間 | 4,427 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 3 TLE * 1 -- * 29 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
int main(){
long long a;cin>>a;
long long ans =(long long)sqrt(a)+2+a-(long long)sqrt(a)*(long long)sqrt(a);
for(int i = 2; 1000001 > i; i++){
long long nw = 1;
for(int j = 0; a >= nw; j++){
if(ans == -1)ans = i+j+a-nw;
else ans = min(ans,i+j+a-nw);
nw *= i;
}
}
cout << ans << endl;
}