結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー gu_21816943gu_21816943
提出日時 2017-06-27 00:26:37
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 725 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 74,504 KB
実行使用メモリ 51,272 KB
最終ジャッジ日時 2024-04-15 02:01:37
合計ジャッジ時間 9,618 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
50,240 KB
testcase_01 AC 52 ms
50,136 KB
testcase_02 AC 52 ms
50,000 KB
testcase_03 AC 77 ms
51,148 KB
testcase_04 AC 52 ms
49,916 KB
testcase_05 AC 52 ms
50,228 KB
testcase_06 AC 52 ms
50,224 KB
testcase_07 AC 52 ms
50,264 KB
testcase_08 AC 53 ms
50,224 KB
testcase_09 AC 51 ms
50,348 KB
testcase_10 AC 51 ms
50,264 KB
testcase_11 AC 52 ms
50,336 KB
testcase_12 AC 52 ms
50,384 KB
testcase_13 AC 52 ms
50,232 KB
testcase_14 AC 52 ms
50,280 KB
testcase_15 AC 53 ms
50,032 KB
testcase_16 AC 53 ms
50,212 KB
testcase_17 AC 53 ms
50,300 KB
testcase_18 AC 53 ms
50,456 KB
testcase_19 AC 133 ms
50,944 KB
testcase_20 AC 365 ms
50,732 KB
testcase_21 AC 53 ms
50,292 KB
testcase_22 AC 54 ms
50,044 KB
testcase_23 AC 52 ms
49,896 KB
testcase_24 AC 52 ms
50,376 KB
testcase_25 AC 660 ms
51,108 KB
testcase_26 AC 53 ms
50,260 KB
testcase_27 AC 52 ms
50,068 KB
testcase_28 AC 52 ms
50,336 KB
testcase_29 AC 52 ms
50,020 KB
testcase_30 AC 53 ms
50,276 KB
testcase_31 AC 53 ms
50,308 KB
testcase_32 AC 290 ms
51,272 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 585 ms
51,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		br.close();
		int num = Integer.parseInt(str[0]) - 1;
		int len = Integer.parseInt(str[1]);

		long count = 0;

		if (num * 2 <= len) {
			count += len - num * 2 + 1;
		}
		int i,j;
		for (i = 3; num * i <= len; i += 2) {
			boolean flag = true;
			for (j = 3; j * j <= i; j += 2) {
				if (i % j == 0) {
					flag = false;
					break;
				}
			}
			if (flag) {
				count += len - num * i + 1;
			}
		}
		System.out.println(count);
	}
}
0