結果
問題 | No.36 素数が嫌い! |
ユーザー | shin |
提出日時 | 2022-05-18 09:55:49 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 864 bytes |
コンパイル時間 | 4,431 ms |
コンパイル使用メモリ | 73,112 KB |
実行使用メモリ | 51,144 KB |
最終ジャッジ日時 | 2023-10-14 16:19:34 |
合計ジャッジ時間 | 7,201 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 42 ms
49,536 KB |
testcase_03 | AC | 40 ms
49,096 KB |
testcase_04 | AC | 41 ms
48,972 KB |
testcase_05 | AC | 42 ms
49,276 KB |
testcase_06 | AC | 41 ms
49,116 KB |
testcase_07 | AC | 41 ms
49,216 KB |
testcase_08 | AC | 40 ms
49,196 KB |
testcase_09 | AC | 40 ms
49,272 KB |
testcase_10 | WA | - |
testcase_11 | AC | 69 ms
49,808 KB |
testcase_12 | AC | 111 ms
50,840 KB |
testcase_13 | AC | 110 ms
49,800 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 41 ms
49,124 KB |
testcase_17 | AC | 42 ms
49,272 KB |
testcase_18 | AC | 42 ms
49,044 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 70 ms
50,688 KB |
testcase_27 | AC | 45 ms
49,136 KB |
testcase_28 | AC | 69 ms
49,624 KB |
testcase_29 | AC | 42 ms
48,968 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No36_2 { static int res = 0; public static void main(String[] args) throws IOException{ //素数が嫌い! long N = Long.parseLong(readStr()[0]); while(N % 2 == 0) { res++; N /= 2; } long i = 3l; do { if(N % i == 0) { res++; N /= i; }else { i += 2; } }while(i <= Math.sqrt(N)); System.out.println(res > 2 ? "YES" : "NO"); } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }