結果

問題 No.36 素数が嫌い!
ユーザー magurogumamaguroguma
提出日時 2017-08-09 10:35:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,379 ms / 5,000 ms
コード長 847 bytes
コンパイル時間 5,539 ms
コンパイル使用メモリ 72,284 KB
実行使用メモリ 56,828 KB
最終ジャッジ日時 2023-09-09 08:06:54
合計ジャッジ時間 15,553 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,304 KB
testcase_01 AC 155 ms
56,372 KB
testcase_02 AC 117 ms
55,988 KB
testcase_03 AC 117 ms
55,976 KB
testcase_04 AC 116 ms
55,920 KB
testcase_05 AC 118 ms
55,708 KB
testcase_06 AC 122 ms
56,184 KB
testcase_07 AC 120 ms
56,112 KB
testcase_08 AC 113 ms
55,800 KB
testcase_09 AC 113 ms
56,100 KB
testcase_10 AC 125 ms
55,880 KB
testcase_11 AC 528 ms
56,048 KB
testcase_12 AC 1,379 ms
55,924 KB
testcase_13 AC 1,376 ms
56,828 KB
testcase_14 AC 126 ms
56,344 KB
testcase_15 AC 117 ms
55,664 KB
testcase_16 AC 113 ms
55,788 KB
testcase_17 AC 116 ms
55,916 KB
testcase_18 AC 126 ms
55,712 KB
testcase_19 AC 113 ms
55,772 KB
testcase_20 AC 176 ms
55,976 KB
testcase_21 AC 115 ms
56,600 KB
testcase_22 AC 119 ms
56,140 KB
testcase_23 AC 122 ms
55,820 KB
testcase_24 AC 326 ms
55,932 KB
testcase_25 AC 112 ms
56,216 KB
testcase_26 AC 882 ms
56,712 KB
testcase_27 AC 1,193 ms
56,076 KB
testcase_28 AC 864 ms
56,408 KB
testcase_29 AC 1,337 ms
56,116 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