結果

問題 No.713 素数の和
ユーザー tsunabittsunabit
提出日時 2019-06-25 22:01:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 5,186 ms
コンパイル使用メモリ 71,980 KB
実行使用メモリ 56,124 KB
最終ジャッジ日時 2023-09-05 13:17:39
合計ジャッジ時間 5,446 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
55,696 KB
testcase_01 AC 125 ms
55,684 KB
testcase_02 AC 125 ms
55,704 KB
testcase_03 AC 131 ms
56,064 KB
testcase_04 AC 132 ms
56,032 KB
testcase_05 AC 125 ms
55,756 KB
testcase_06 AC 125 ms
56,040 KB
testcase_07 AC 127 ms
56,056 KB
testcase_08 AC 128 ms
56,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No713 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int o = 0;
    	for(int i = 1; i <= n; i++) {
    		int yaku = 0;
    		for(int j = 1; j <= i; j++) {
    			if(i % j == 0) {
    				yaku++;
    			}
    		}
    		if(yaku == 2) {
    			o += i;
    		}
    	}
    	System.out.println(o);
    }
}
0