結果
| 問題 | No.407 鴨等素数間隔列の数え上げ |
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2016-08-05 23:11:57 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 191 ms / 1,000 ms |
| コード長 | 446 bytes |
| 記録 | |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 40,868 KB |
| 実行使用メモリ | 43,048 KB |
| 最終ジャッジ日時 | 2026-05-26 05:05:53 |
| 合計ジャッジ時間 | 7,629 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 |
ソースコード
#include <stdio.h>
typedef long long int LL;
LL n, l, ans;
int comp[10000001];
int main() {
scanf("%lld%lld", &n, &l);
for(int i = 2; i <= 10000000; i++) {
if(comp[i] == 0) {
for(int j = i * 2; j <= 10000000; j += i) {
comp[j] = 1;
}
}
}
ans = 0;
for(LL i = 2; i <= 10000000; i++) {
if(comp[i] == 0) {
LL temp = l + 1 - i * (n - 1);
if(temp > 0) { ans += temp; }
}
}
printf("%lld\n", ans);
return 0;
}
FF256grhy