結果
問題 | No.2379 Burnside's Theorem |
ユーザー | あさくち |
提出日時 | 2023-07-14 21:24:43 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 1,089 bytes |
コンパイル時間 | 1,470 ms |
コンパイル使用メモリ | 156,676 KB |
実行使用メモリ | 4,368 KB |
最終ジャッジ日時 | 2023-10-14 11:21:40 |
合計ジャッジ時間 | 2,535 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 0 ms
4,352 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 1 ms
4,352 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,352 KB |
testcase_07 | AC | 1 ms
4,352 KB |
testcase_08 | AC | 1 ms
4,368 KB |
testcase_09 | AC | 1 ms
4,352 KB |
testcase_10 | AC | 1 ms
4,348 KB |
testcase_11 | AC | 1 ms
4,352 KB |
testcase_12 | AC | 1 ms
4,352 KB |
testcase_13 | AC | 6 ms
4,352 KB |
testcase_14 | AC | 8 ms
4,356 KB |
testcase_15 | AC | 10 ms
4,352 KB |
testcase_16 | AC | 2 ms
4,352 KB |
testcase_17 | AC | 1 ms
4,348 KB |
testcase_18 | AC | 5 ms
4,356 KB |
testcase_19 | AC | 1 ms
4,356 KB |
testcase_20 | AC | 1 ms
4,348 KB |
testcase_21 | AC | 1 ms
4,356 KB |
testcase_22 | AC | 1 ms
4,356 KB |
testcase_23 | AC | 1 ms
4,348 KB |
ソースコード
use std::collections::HashSet; // #[proconio::fastout] fn main() { let n: usize = input_value(); let primes = prime_factorize(n); let mut set = HashSet::new(); for prime in primes { set.insert(prime); } if set.len() <= 2 { println!("Yes"); } else { println!("No"); } } fn input_value<T>() -> T where T: std::str::FromStr, <T as std::str::FromStr>::Err: std::fmt::Debug, { let stdin = std::io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf).unwrap(); buf = buf.trim_end().to_owned(); let n = buf.parse().unwrap(); n } fn prime_factorize(n: usize) -> Vec<usize> { let mut current = n; let mut list = Vec::new(); { let mut i = 2; while i * i <= n { while current % i == 0 { list.push(i); current /= i; } if current == 1 { break; } i += 1; } if current != 1 { list.push(current); } } list }