結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
55,984 KB
testcase_01 AC 220 ms
55,336 KB
testcase_02 AC 121 ms
55,844 KB
testcase_03 AC 122 ms
56,036 KB
testcase_04 WA -
testcase_05 AC 127 ms
57,708 KB
testcase_06 AC 128 ms
55,748 KB
testcase_07 AC 125 ms
55,796 KB
testcase_08 AC 125 ms
55,460 KB
testcase_09 AC 124 ms
55,580 KB
testcase_10 AC 125 ms
55,736 KB
testcase_11 AC 167 ms
55,700 KB
testcase_12 AC 242 ms
55,700 KB
testcase_13 WA -
testcase_14 AC 198 ms
56,128 KB
testcase_15 AC 123 ms
55,628 KB
testcase_16 AC 127 ms
55,824 KB
testcase_17 AC 125 ms
55,696 KB
testcase_18 AC 126 ms
55,912 KB
testcase_19 AC 175 ms
53,812 KB
testcase_20 AC 247 ms
55,568 KB
testcase_21 AC 218 ms
55,892 KB
testcase_22 AC 220 ms
55,724 KB
testcase_23 AC 183 ms
55,648 KB
testcase_24 AC 192 ms
55,656 KB
testcase_25 AC 188 ms
55,580 KB
testcase_26 AC 196 ms
55,612 KB
testcase_27 AC 228 ms
55,572 KB
testcase_28 AC 194 ms
55,864 KB
testcase_29 AC 237 ms
55,668 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 != 1){
			types++;
		}
		
		if(types >= 3 || max_counts >= 2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
	}
	
}
0