結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-01 19:50:45 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 802 bytes |
| コンパイル時間 | 13,045 ms |
| コンパイル使用メモリ | 378,536 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 02:28:02 |
| 合計ジャッジ時間 | 14,419 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 13 |
ソースコード
use std::io::{self, Read as _};
fn main() {
let mut input = "".to_owned();
io::stdin().read_to_string(&mut input).unwrap();
let mut input = input.split_ascii_whitespace();
macro_rules! read(($ty:tt) => (input.next().unwrap().parse::<$ty>().unwrap()));
let mut n = read!(u64);
let mut facts = vec![];
for k in 2..=10000 {
let mut exp = 0;
while n % k == 0 {
n /= k;
exp += 1;
}
if exp > 0 {
facts.push((k, exp));
}
}
let (mut s, mut t) = (0, 0);
for (_, exp) in facts {
if exp == 1 {
s += 1;
} else {
t += 1;
}
}
let ans = if t == 0 { s % 2 == 1 } else { t % 2 == 1 };
println!("{}", if ans { "Alice" } else { "Bob" });
}