結果
| 問題 |
No.1664 Unstable f(n)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-04 13:51:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 427 bytes |
| コンパイル時間 | 2,017 ms |
| コンパイル使用メモリ | 192,212 KB |
| 最終ジャッジ日時 | 2025-02-08 17:08:57 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n,ans,val,lim,k;
cin >> n;
lim = 1000000000000;
ans = 1000000000000000000;
for (ll i=1; i<=1000000;i++){
for (ll j=1; j<=50;j++){
if (pow(i,j) > min(lim,n)){
break;
}
k = i+j+n-(pow(i,j));
ans = min(ans,k);
}
}
cout << ans << endl;
}