結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー FF256grhyFF256grhy
提出日時 2016-08-05 23:11:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 328 ms / 1,000 ms
コード長 446 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 25,384 KB
実行使用メモリ 42,096 KB
最終ジャッジ日時 2023-08-22 04:05:38
合計ジャッジ時間 12,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 305 ms
42,088 KB
testcase_01 AC 308 ms
42,024 KB
testcase_02 AC 311 ms
42,064 KB
testcase_03 AC 303 ms
42,060 KB
testcase_04 AC 305 ms
42,092 KB
testcase_05 AC 294 ms
42,072 KB
testcase_06 AC 301 ms
42,052 KB
testcase_07 AC 304 ms
42,024 KB
testcase_08 AC 301 ms
41,940 KB
testcase_09 AC 303 ms
42,088 KB
testcase_10 AC 298 ms
42,056 KB
testcase_11 AC 296 ms
42,016 KB
testcase_12 AC 293 ms
42,016 KB
testcase_13 AC 292 ms
42,068 KB
testcase_14 AC 297 ms
42,088 KB
testcase_15 AC 293 ms
42,048 KB
testcase_16 AC 301 ms
42,008 KB
testcase_17 AC 302 ms
42,024 KB
testcase_18 AC 298 ms
42,016 KB
testcase_19 AC 300 ms
42,020 KB
testcase_20 AC 301 ms
42,040 KB
testcase_21 AC 298 ms
42,036 KB
testcase_22 AC 304 ms
42,028 KB
testcase_23 AC 328 ms
42,008 KB
testcase_24 AC 302 ms
42,028 KB
testcase_25 AC 306 ms
42,076 KB
testcase_26 AC 299 ms
42,004 KB
testcase_27 AC 301 ms
42,096 KB
testcase_28 AC 301 ms
42,020 KB
testcase_29 AC 297 ms
42,076 KB
testcase_30 AC 294 ms
42,080 KB
testcase_31 AC 302 ms
42,052 KB
testcase_32 AC 298 ms
42,088 KB
testcase_33 AC 307 ms
42,052 KB
testcase_34 AC 298 ms
42,052 KB
testcase_35 AC 299 ms
42,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0