結果
問題 |
No.1664 Unstable f(n)
|
ユーザー |
|
提出日時 | 2021-09-04 11:24:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 1,677 ms |
コンパイル使用メモリ | 167,080 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-17 19:09:29 |
合計ジャッジ時間 | 2,852 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 WA * 2 |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; int n,t,len,l; int k; int i,ans; int qpow(int x,int y){ int ans=1; while(y){ if(y&1){ ans*=x; } x*=x; y>>=1; } return ans; } signed main(){ cin>>n; ans=n; for(int j=log2(n);j;j--){ l=pow(n,1.0/j); for(int i=l-1;qpow(i,j)<=n;i++){ ans=min(ans,n-(int)qpow(i,j)+i+j); //cout<<i<<" "<<j<<" "<<n-qpow(i,j)<<endl; } } cout<<ans<<endl; return 0; }