結果
| 問題 |
No.1664 Unstable f(n)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-03 21:48:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 601 bytes |
| コンパイル時間 | 4,074 ms |
| コンパイル使用メモリ | 157,704 KB |
| 最終ジャッジ日時 | 2025-01-24 05:26:34 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 TLE * 14 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cstring>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)
int main(){
ll n;
cin >> n;
ll ans = 1e18;
for (ll i = 1; i < 1e7;i++){
ll x = i;
ans = min(ans,i+n-1);
if (i == 1) continue;
ll j = 1;
while(x <= n){
ans = min(ans,i+j+n-x);
j++;
x*=i;
}
}
cout << ans << endl;
return 0;
}