結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー togari_takamototogari_takamoto
提出日時 2016-05-13 23:19:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 955 bytes
コンパイル時間 1,674 ms
コンパイル使用メモリ 159,360 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-15 16:57:45
合計ジャッジ時間 4,732 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 3 ms
5,376 KB
testcase_28 AC 61 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 TLE -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned int;
using vi  = vector<int>; using vb  = vector<bool>; using vd  = vector<double>; using vl  = vector<ll>;
using vvi = vector<vi>;  using vvb = vector<vb>;   using vvd = vector<vd>;     using vvl = vector<vl>;
 
#define REP(i,n) for(ll i=0; i<(n); ++i)
#define FOR(i,b,n) for(ll i=(b); i<(n); ++i)
 
ll min_prime(ll n) {
	FOR(i, 2, sqrt(n)+1) if (n%i == 0) return i;
	return 1;
}

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	ll n, m; cin >> n >> m;

	if ((ll)sqrt(m) * (ll)sqrt(m) >= n) {
		ll x = sqrt(m);
		for (ll i = m; i >= n; --i) if(i%x==0){
			cout << i << endl;
			return 0;
		}
	}

	ll ma = 1;
	ll mai = 1;
	for (ll i = m; i >= n; --i) {
		ll x = min_prime(i);
		if (ma < x) {
			ma = x;
			mai = i;
		}
	}

	cout << mai << endl;
	return 0;
}
0