結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
Tsukasa_Type
|
| 提出日時 | 2018-02-15 00:46:35 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 445 bytes |
| コンパイル時間 | 3,054 ms |
| コンパイル使用メモリ | 74,676 KB |
| 実行使用メモリ | 41,620 KB |
| 最終ジャッジ日時 | 2024-12-23 11:36:41 |
| 合計ジャッジ時間 | 10,043 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 WA * 9 |
ソースコード
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)>=1?"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;
}
}
Tsukasa_Type