結果
問題 |
No.1657 Sum is Prime (Easy Version)
|
ユーザー |
|
提出日時 | 2022-03-05 21:23:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 404 bytes |
コンパイル時間 | 1,740 ms |
コンパイル使用メモリ | 174,536 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2024-07-20 03:53:58 |
合計ジャッジ時間 | 7,445 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 9 WA * 12 |
ソースコード
#include<bits/stdc++.h> using namespace std; bool isPrime(int x){ if(x==1)return 0; if(x==2)return 1; for(int i=2;i*i<=x;i++)if(x%i==0)return 0; return 1; } int main(){ int L,R; cin>>L>>R; int count=0; map<int,int>Map; for(int i=L;i<=R;i++){ if(isPrime(i)==1){ Map[i]++; count++; } } for(int i=L;i<=R;i++)if(isPrime(2*i+1)==1&&Map[2*i+1]==0)count++; cout<<count; }