結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー FF256grhyFF256grhy
提出日時 2016-08-05 23:09:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 5,504 KB
最終ジャッジ日時 2024-04-24 16:30:41
合計ジャッジ時間 1,688 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
5,376 KB
testcase_01 AC 14 ms
5,504 KB
testcase_02 AC 13 ms
5,376 KB
testcase_03 AC 13 ms
5,504 KB
testcase_04 AC 13 ms
5,376 KB
testcase_05 AC 13 ms
5,504 KB
testcase_06 AC 13 ms
5,504 KB
testcase_07 AC 13 ms
5,504 KB
testcase_08 AC 14 ms
5,504 KB
testcase_09 AC 12 ms
5,504 KB
testcase_10 AC 13 ms
5,504 KB
testcase_11 AC 13 ms
5,504 KB
testcase_12 AC 13 ms
5,504 KB
testcase_13 AC 13 ms
5,504 KB
testcase_14 AC 13 ms
5,376 KB
testcase_15 AC 13 ms
5,376 KB
testcase_16 AC 13 ms
5,504 KB
testcase_17 AC 12 ms
5,504 KB
testcase_18 AC 13 ms
5,504 KB
testcase_19 AC 13 ms
5,504 KB
testcase_20 WA -
testcase_21 AC 13 ms
5,504 KB
testcase_22 AC 13 ms
5,504 KB
testcase_23 AC 13 ms
5,504 KB
testcase_24 AC 13 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 14 ms
5,376 KB
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 14 ms
5,504 KB
testcase_29 AC 13 ms
5,504 KB
testcase_30 AC 14 ms
5,504 KB
testcase_31 AC 13 ms
5,504 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

typedef long long int LL;

LL n, l, ans;

int comp[1000001];

int main() {
	scanf("%lld%lld", &n, &l);
	
	for(int i = 2; i <= 1000000; i++) {
		if(comp[i] == 0) {
			for(int j = i * 2; j <= 1000000; j += i) {
				comp[j] = 1;
			}
		}
	}
	
	ans = 0;
	for(LL i = 2; i <= 1000000; i++) {
		if(comp[i] == 0) {
			LL temp = l + 1 - i * (n - 1);
			if(temp > 0) { ans += temp; }
		}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}
0