結果
| 問題 |
No.1664 Unstable f(n)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-04 11:00:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 400 bytes |
| コンパイル時間 | 1,587 ms |
| コンパイル使用メモリ | 166,824 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-17 18:37:14 |
| 合計ジャッジ時間 | 2,762 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 8 |
ソースコード
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,t,len,l;
int k;
int i,ans;
signed main(){
cin>>n;
ans=t=n;
while(t){
len++;
t>>=1;
}
l=2;
for(int j=len;j;j--){
l=(int)pow(n,(double)1/j);
for(int i=l-2;i<l+2;i++){
if(pow(i,j)<=n){
ans=min(ans,n-(int)pow(i,j)+i+j);
}
}
//cout<<i<<" "<<j<<" "<<k<<endl;
}
cout<<ans<<endl;
return 0;
}