結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー suppy193suppy193
提出日時 2017-01-31 14:07:12
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 544 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 26,468 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-25 14:06:55
合計ジャッジ時間 5,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,760 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 46 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 0 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 0 ms
4,380 KB
testcase_17 AC 0 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 269 ms
4,380 KB
testcase_20 TLE -
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 0 ms
4,376 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(void) {
	long long int n, l;
	long long int d_max;
	long long int i, j;
	int flag;
	long long int count = 0;
	int prime[10000] = {0};
	scanf("%lld%lld", &n, &l);
	d_max = l / (n - 1);

	if(d_max >= 2){
		count += l - 2 * (n - 1) + 1;
	}
	for(i = 3;i <= d_max;i += 2){
		flag = 1;
		for(j = 2;j <= sqrt(i);j++){
			if(i % j == 0){
				flag = 0;
				break;
			}
		}
		if(flag == 1){
			//printf("%d is prime.\n", i);
			count += l - i * (n - 1) + 1;
		}
	}
	printf("%lld\n", count);
		
	return 0;
}
0