結果
問題 |
No.1664 Unstable f(n)
|
ユーザー |
![]() |
提出日時 | 2021-12-08 21:54:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 1,599 ms |
コンパイル使用メモリ | 167,056 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-07-16 09:48:04 |
合計ジャッジ時間 | 5,517 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 TLE * 1 -- * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int,int>; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ ll n; cin >> n; ll ans = 100100100100100; for(ll i=2;i<=ans;i++){ ll x = 1, cnt = 0; while(x<=n/i){ x *= i; cnt++; } ans = min(ans, i+cnt+n-x); } cout << ans << endl; return 0; }