結果
| 問題 | No.407 鴨等素数間隔列の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-07 19:18:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 450 bytes |
| 記録 | |
| コンパイル時間 | 1,382 ms |
| コンパイル使用メモリ | 157,776 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 14:16:05 |
| 合計ジャッジ時間 | 5,127 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 12 WA * 3 RE * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
bool memo[1000010];
int main(){
int n, l;
cin >> n >> l;
memset(memo,true,sizeof(memo));
memo[1] = false;
for(int i = 2;i < 1000010;i++){
if(memo[i]){
for(int j = i*2; j < 1000010;j+=i){
memo[j] = false;
}
}
}
long long ans = 0;
for(int i = 2;i <= l;i++){
if(memo[i]){
ans += max(l-i*(n-1)+1, 0);
}
}
cout << ans << endl;
return 0;
}