結果

問題 No.1664 Unstable f(n)
ユーザー 同传man辛苦了
提出日時 2021-09-04 11:27:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 1,391 ms
コンパイル使用メモリ 167,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 19:11:19
合計ジャッジ時間 2,577 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int unsigned 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;
}
0