結果
問題 |
No.1664 Unstable f(n)
|
ユーザー |
|
提出日時 | 2021-09-04 11:23:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 493 bytes |
コンパイル時間 | 1,579 ms |
コンパイル使用メモリ | 167,384 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 19:08:44 |
合計ジャッジ時間 | 2,587 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; 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;pow(i,j)<=n;i++){ ans=min(ans,n-(int)pow(i,j)+i+j); // cout<<i<<" "<<j<<" "<<n-qpow(i,j)<<endl; } } cout<<ans<<endl; return 0; }