結果
| 問題 |
No.371 ぼく悪いプライムじゃないよ
|
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2016-05-13 23:04:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 927 bytes |
| コンパイル時間 | 759 ms |
| コンパイル使用メモリ | 89,516 KB |
| 実行使用メモリ | 136,576 KB |
| 最終ジャッジ日時 | 2024-10-05 17:30:44 |
| 合計ジャッジ時間 | 51,340 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 4 |
| other | TLE * 42 |
ソースコード
//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