結果

問題 No.36 素数が嫌い!
ユーザー m2543315647m2543315647
提出日時 2015-05-13 14:02:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 383 bytes
コンパイル時間 5,752 ms
コンパイル使用メモリ 73,004 KB
実行使用メモリ 56,040 KB
最終ジャッジ日時 2023-09-20 05:19:36
合計ジャッジ時間 15,135 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,040 KB
testcase_01 AC 128 ms
55,404 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 3,144 ms
55,848 KB
testcase_08 AC 130 ms
55,600 KB
testcase_09 AC 130 ms
55,784 KB
testcase_10 AC 130 ms
55,664 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No36 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(check(sc.nextLong())?"YES":"NO");
	}
	public static boolean check(Long n) {
		if (n == 1) return false;
		if (n % 2 == 0 || n <= 2) return true;
		for (int i = 3; i <= n / 2; i += 2)
			if (n % i == 0) return true;
		return false;
	}
}
0