結果

問題 No.1176 少ない質問
ユーザー Beat7502
提出日時 2020-08-21 23:01:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 523 bytes
コンパイル時間 1,454 ms
コンパイル使用メモリ 165,956 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 06:09:21
合計ジャッジ時間 2,193 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using ll = long long;
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a;cin >> a;
	ll miku = 1;
	int ans = 0;
	while(miku < a){
		ans++;
		miku *= 2;
	}
	ans *= 2;
	for(ll i = 3; i < 10000; i += 2){
		int k = 0;
		for(ll j = 3; j <= sqrt(i); j += 2){
			if(i%j==0){
				k = 1;
				break;
			}
		}
		if(k == 0){
			int tmp = 0;
			ll mtmp = 1;
			while(mtmp < a){
				tmp++;
				mtmp *= i;
			}
			ans = min((ll)ans, tmp*i);
		}
	}
	cout << ans << endl;
	return 0;
}
0