結果

問題 No.36 素数が嫌い!
ユーザー tentententen
提出日時 2022-07-28 17:10:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,198 bytes
コンパイル時間 3,477 ms
コンパイル使用メモリ 72,148 KB
実行使用メモリ 51,068 KB
最終ジャッジ日時 2023-09-25 09:41:24
合計ジャッジ時間 6,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,176 KB
testcase_01 AC 45 ms
49,848 KB
testcase_02 AC 44 ms
49,232 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 45 ms
49,512 KB
testcase_08 AC 45 ms
49,272 KB
testcase_09 AC 43 ms
49,728 KB
testcase_10 AC 45 ms
49,448 KB
testcase_11 AC 87 ms
51,068 KB
testcase_12 AC 160 ms
50,780 KB
testcase_13 WA -
testcase_14 AC 45 ms
49,364 KB
testcase_15 AC 44 ms
49,872 KB
testcase_16 AC 43 ms
49,228 KB
testcase_17 AC 44 ms
49,236 KB
testcase_18 AC 43 ms
49,280 KB
testcase_19 AC 44 ms
49,380 KB
testcase_20 AC 43 ms
49,296 KB
testcase_21 AC 43 ms
49,320 KB
testcase_22 AC 43 ms
49,276 KB
testcase_23 AC 44 ms
49,296 KB
testcase_24 AC 44 ms
49,372 KB
testcase_25 AC 44 ms
49,288 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        if (isPrime(sc.nextLong())) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
    
    static boolean isPrime(long x) {
        for (int i = 2; i <= Math.sqrt(x); i++) {
            if (x % i == 0) {
                return false;
            }
        }
        return true;
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0