結果
| 問題 | No.371 ぼく悪いプライムじゃないよ |
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2016-05-13 23:04:27 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 927 bytes |
| 記録 | |
| コンパイル時間 | 942 ms |
| コンパイル使用メモリ | 108,696 KB |
| 実行使用メモリ | 134,804 KB |
| 最終ジャッジ日時 | 2026-04-21 03:46:23 |
| 合計ジャッジ時間 | 44,597 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 5 WA * 31 TLE * 6 |
ソースコード
//uso
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;
const long long mod=1000000007;
const int N=50000;
int main()
{
long long l,r;
cin>>l>>r;
vector<long long> primes;
vector<bool> is_prime(N+1,true);
is_prime[0]=is_prime[1]=false;
for(long long i=2;i<N+1;i++){
if(!is_prime[i]) continue;
primes.push_back(i);
for(int j=2LL*i;j<N+1;j+=i) is_prime[j]=false;
}
//cout<<primes.size()<<endl;
vector<long long> p2;
for(int i=0;i<primes.size();i++){
for(int j=i+1;j<primes.size();j++) p2.push_back(primes[i]*primes[j]);
p2.push_back(primes[i]*primes[i]);
}
sort(p2.begin(),p2.end());
auto pos=upper_bound(p2.begin(),p2.end(),r);
pos--;
cout<<*pos<<endl;
return 0;
}
Lay_ec