結果

問題 No.36 素数が嫌い!
ユーザー spaciaspacia
提出日時 2016-01-12 23:09:24
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 767 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 74,588 KB
実行使用メモリ 59,032 KB
最終ジャッジ日時 2024-04-27 15:15:04
合計ジャッジ時間 11,016 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
50,088 KB
testcase_01 AC 54 ms
50,072 KB
testcase_02 AC 50 ms
50,284 KB
testcase_03 AC 50 ms
49,952 KB
testcase_04 AC 51 ms
50,108 KB
testcase_05 AC 52 ms
50,268 KB
testcase_06 AC 52 ms
50,204 KB
testcase_07 AC 52 ms
49,960 KB
testcase_08 AC 49 ms
50,140 KB
testcase_09 AC 49 ms
50,120 KB
testcase_10 AC 49 ms
50,176 KB
testcase_11 AC 96 ms
50,808 KB
testcase_12 AC 169 ms
50,812 KB
testcase_13 AC 174 ms
50,776 KB
testcase_14 AC 56 ms
50,332 KB
testcase_15 AC 52 ms
50,152 KB
testcase_16 AC 51 ms
49,764 KB
testcase_17 AC 50 ms
50,204 KB
testcase_18 AC 51 ms
50,096 KB
testcase_19 AC 50 ms
50,252 KB
testcase_20 AC 52 ms
50,256 KB
testcase_21 AC 48 ms
49,656 KB
testcase_22 AC 50 ms
50,308 KB
testcase_23 AC 51 ms
50,184 KB
testcase_24 AC 70 ms
50,748 KB
testcase_25 AC 53 ms
49,836 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static boolean isPrime (long n) {
		if (n == 1 || (n != 2 && n % 2 == 0)) return false;
		for (int i = 3; i * i <= n; i += 2)
			if (n % i == 0) return false;
		return true;
	}
	
	public static boolean solve (long n) {
		if (n == 1) return false;
		for (long i = 2; i * i <= n; i++) {
			//if (i % 1000000 == 0) out(i);
			if (n % i != 0) continue;
			if (!isPrime(i) || !isPrime(n / i)) return true;
		}
		return false;
	}
	
	public static void main (String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		out(solve(Long.parseLong(br.readLine())) ? "YES" : "NO");
	}
}
0