結果

問題 No.2 素因数ゲーム
ユーザー qryxipqryxip
提出日時 2020-07-01 19:50:45
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 802 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 148,480 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-12 02:41:07
合計ジャッジ時間 4,207 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 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,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,356 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,352 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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" });
}
0