結果

問題 No.713 素数の和
ユーザー 37zigen37zigen
提出日時 2018-07-13 22:43:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 1,888 ms
コンパイル使用メモリ 73,932 KB
実行使用メモリ 44,440 KB
最終ジャッジ日時 2024-04-17 11:15:23
合計ジャッジ時間 4,076 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
44,240 KB
testcase_01 AC 118 ms
40,940 KB
testcase_02 AC 124 ms
41,036 KB
testcase_03 AC 193 ms
43,124 KB
testcase_04 AC 224 ms
44,440 KB
testcase_05 AC 182 ms
42,444 KB
testcase_06 AC 121 ms
41,232 KB
testcase_07 AC 123 ms
41,104 KB
testcase_08 AC 182 ms
42,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		long ans = 0;
		int N = sc.nextInt();
		for (int i = 2; i <= N; ++i)
			if (BigInteger.valueOf(i).isProbablePrime(20))
				ans += i;
		System.out.println(ans);
	}

}
0