結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2016-08-05 23:11:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 255 ms / 1,000 ms |
| コード長 | 446 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 40,700 KB |
| 最終ジャッジ日時 | 2024-12-15 21:59:53 |
| 合計ジャッジ時間 | 10,120 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%lld%lld", &n, &l);
| ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
#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