結果

問題 No.36 素数が嫌い!
ユーザー uafr_csuafr_cs
提出日時 2015-06-03 15:03:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 73,276 KB
実行使用メモリ 56,272 KB
最終ジャッジ日時 2023-09-20 18:58:54
合計ジャッジ時間 8,396 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 179 ms
55,696 KB
testcase_01 AC 218 ms
55,860 KB
testcase_02 AC 120 ms
55,984 KB
testcase_03 AC 119 ms
54,724 KB
testcase_04 WA -
testcase_05 AC 123 ms
55,328 KB
testcase_06 AC 123 ms
55,940 KB
testcase_07 AC 121 ms
55,984 KB
testcase_08 AC 122 ms
55,780 KB
testcase_09 AC 124 ms
55,868 KB
testcase_10 AC 125 ms
55,680 KB
testcase_11 AC 165 ms
56,272 KB
testcase_12 AC 240 ms
55,872 KB
testcase_13 WA -
testcase_14 AC 198 ms
55,944 KB
testcase_15 AC 122 ms
55,864 KB
testcase_16 AC 124 ms
55,960 KB
testcase_17 AC 122 ms
55,956 KB
testcase_18 AC 126 ms
55,828 KB
testcase_19 AC 173 ms
56,248 KB
testcase_20 AC 240 ms
56,200 KB
testcase_21 AC 212 ms
55,652 KB
testcase_22 AC 217 ms
56,132 KB
testcase_23 AC 182 ms
55,904 KB
testcase_24 AC 192 ms
56,136 KB
testcase_25 AC 188 ms
55,976 KB
testcase_26 AC 195 ms
55,872 KB
testcase_27 AC 222 ms
55,488 KB
testcase_28 AC 197 ms
55,948 KB
testcase_29 AC 236 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final long N = sc.nextLong();
		
		if(N == 1){
			System.out.println("NO");
			return;
		}
		
		final int sqrt_N = (int)(Math.floor(Math.sqrt(N)));
		long cur_N = N;
		int types = 0, max_counts = 0;
		for(int i = 2; i <= sqrt_N; i++){
			int count = 0;
			while(cur_N % i == 0){
				count++;
				cur_N /= i;
			}
			
			max_counts = Math.max(max_counts, count);
			if(count != 0){
				types++;
			}
		}
		
		if(cur_N != 0){
			types++;
		}
		
		if(types >= 3 || max_counts >= 2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
	}
	
}
0