結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2018-02-15 00:49:53 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 252 ms / 5,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 2,496 ms |
コンパイル使用メモリ | 74,456 KB |
実行使用メモリ | 54,276 KB |
最終ジャッジ日時 | 2024-06-27 01:18:19 |
合計ジャッジ時間 | 8,611 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
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++) { int num = 0; while (n%i==0) { n /= i; num++; } total += num; } return total; } }