結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-21 17:16:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 2,046 ms |
| コンパイル使用メモリ | 172,636 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-17 10:29:35 |
| 合計ジャッジ時間 | 10,533 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 5 |
| other | RE * 31 |
コンパイルメッセージ
main.cpp: In function 'int setPrime(int)':
main.cpp:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
24 | }
| ^
ソースコード
#include<bits/stdc++.h>
using namespace std;
int N, L;
vector<bool> prime;
int setPrime(int n){
prime.resize(n+1);
prime.assign(n+1, 1);
prime[0] = 0;
prime[1] = 0;
prime[2] = 1;
for(int i=2; i<=n; ++i){
if(prime[i]==1){
int j=i*2;
while(j<=n){
prime[j] = 0;
j += i;
}
}
}
}
int main(){
cin >> N >> L;
setPrime(L);
unsigned long long int count = 0;
for(int i=0; i<=L; ++i){
if(prime[i]){
if((N-1)*i<=L){
count += L - ((N-1)*i) + 1;
}
}
}
cout << count << endl;
return 0;
}