結果
| 問題 | No.36 素数が嫌い! |
| コンテスト | |
| ユーザー |
Maricom_tkg
|
| 提出日時 | 2018-11-16 19:00:08 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 579 bytes |
| 記録 | |
| コンパイル時間 | 610 ms |
| コンパイル使用メモリ | 178,788 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-30 09:57:52 |
| 合計ジャッジ時間 | 2,688 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
use std::io::Read;
fn main() {
let mut buf = String::new();
std::io::stdin().read_to_string(&mut buf).unwrap();
let mut n: u64 = buf.trim().parse().unwrap();
let limit: u64 = (n as f64).sqrt() as u64;
let mut prime_count: usize = 0;
let mut num: u64 = 2;
while num <= limit && n > 1 {
if prime_count >= 2 {
println!("YES");
return;
}
if n % num == 0 {
n /= num;
prime_count += 1;
} else {
num += num%2 + 1;
}
}
println!("NO")
}
Maricom_tkg