結果

問題 No.36 素数が嫌い!
ユーザー magurogumamaguroguma
提出日時 2017-08-09 10:34:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 848 bytes
コンパイル時間 3,420 ms
コンパイル使用メモリ 74,988 KB
実行使用メモリ 54,436 KB
最終ジャッジ日時 2024-04-20 08:22:53
合計ジャッジ時間 11,817 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,328 KB
testcase_01 AC 153 ms
54,200 KB
testcase_02 AC 117 ms
52,848 KB
testcase_03 AC 127 ms
54,208 KB
testcase_04 WA -
testcase_05 AC 131 ms
54,152 KB
testcase_06 AC 129 ms
53,912 KB
testcase_07 AC 143 ms
54,044 KB
testcase_08 AC 136 ms
54,008 KB
testcase_09 AC 131 ms
54,036 KB
testcase_10 AC 125 ms
54,208 KB
testcase_11 AC 313 ms
53,124 KB
testcase_12 AC 737 ms
54,180 KB
testcase_13 WA -
testcase_14 AC 135 ms
54,004 KB
testcase_15 AC 132 ms
54,160 KB
testcase_16 AC 132 ms
54,156 KB
testcase_17 AC 136 ms
54,284 KB
testcase_18 AC 134 ms
54,036 KB
testcase_19 AC 133 ms
54,244 KB
testcase_20 AC 158 ms
53,972 KB
testcase_21 AC 130 ms
54,248 KB
testcase_22 AC 130 ms
54,300 KB
testcase_23 AC 131 ms
53,812 KB
testcase_24 AC 208 ms
53,280 KB
testcase_25 AC 132 ms
54,368 KB
testcase_26 AC 501 ms
54,436 KB
testcase_27 AC 651 ms
54,264 KB
testcase_28 AC 487 ms
54,424 KB
testcase_29 AC 713 ms
54,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class yuki36 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        boolean flag = true;

        int divisorCount = 0;
        for(long i=2; i*i<=N; i++){
            /*if(N%i == 0){
                divisorCount++;
            }*/
        	for(int j=1; Math.pow(i,j)<=N; j++){
        		if(N%Math.pow(i,j)==0){
        			divisorCount++;
        			if(divisorCount==2){
        				break;
        			}
        		}
        		else{
        			break;
        		}
        	}
            if(divisorCount==2){
                System.out.println("YES");
                flag = false;
                break;
            }
        }
        if(flag)
        	System.out.println("NO");
	}

}
0