結果
問題 |
No.1657 Sum is Prime (Easy Version)
|
ユーザー |
|
提出日時 | 2022-03-05 21:26:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 712 ms / 2,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 172,812 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-07-20 03:56:48 |
合計ジャッジ時間 | 6,157 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#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)count++; cout<<count; }