結果
| 問題 | No.371 ぼく悪いプライムじゃないよ |
| コンテスト | |
| ユーザー |
kyuridenamida
|
| 提出日時 | 2016-05-18 22:51:33 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 967 ms |
| コンパイル使用メモリ | 175,760 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-22 00:50:13 |
| 合計ジャッジ時間 | 3,327 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long g(int n){
long long mx = 1e18;
for(long long i = 2 ; i*i <= n ; i++){
if( n % i == 0 ) return i;
}
return n;
}
long long f(int n){
long long mx = 1e18;
for(long long i = 2 ; i*i <= n ; i++){
if( n % i == 0 ) return i;
}
return 0;
}
int main(){
long long L,H;
cin >> L >> H;
for(long long i = sqrt(H)+0.5 ; i >= 1 ; i--){
if( f(i) == 0 ){
long long x = (H/i);
while( x >= i and g(x) < i ) x--;
if( x != 1 and g(x) >= i and x*i >= L and x*i <= H) {
cout << x*i << endl;
return 0;
}
}
}
}
kyuridenamida