結果

問題 No.36 素数が嫌い!
ユーザー uafr_cs
提出日時 2015-06-03 15:03:47
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 1,668 ms
コンパイル使用メモリ 75,112 KB
実行使用メモリ 54,228 KB
最終ジャッジ日時 2024-07-06 13:53:29
合計ジャッジ時間 6,903 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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