結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2018-02-15 00:45:03 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 445 bytes |
コンパイル時間 | 1,918 ms |
コンパイル使用メモリ | 74,576 KB |
実行使用メモリ | 54,328 KB |
最終ジャッジ日時 | 2024-12-23 11:35:41 |
合計ジャッジ時間 | 7,696 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 22 WA * 4 |
ソースコード
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long n = sc.nextLong(); System.out.println(PrimeFact(n)>=2?"YES":"NO"); } static int PrimeFact (long n) { double sqrt = Math.sqrt(n); int total = 0; for (int i=2; i<=sqrt; i++) { boolean b = false; while (n%i==0) { n /= i; b = true; } if (b==true) {total++;} } return total; } }