結果

問題 No.2 素因数ゲーム
ユーザー Takumi WatanabeTakumi Watanabe
提出日時 2024-03-15 19:10:25
言語 Rust
(1.77.0)
結果
AC  
実行時間 414 ms / 5,000 ms
コード長 1,067 bytes
コンパイル時間 1,223 ms
コンパイル使用メモリ 174,364 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-15 19:10:41
合計ジャッジ時間 9,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 52 ms
6,676 KB
testcase_07 AC 60 ms
6,676 KB
testcase_08 AC 54 ms
6,676 KB
testcase_09 AC 414 ms
6,676 KB
testcase_10 AC 356 ms
6,676 KB
testcase_11 AC 166 ms
6,676 KB
testcase_12 AC 165 ms
6,676 KB
testcase_13 AC 337 ms
6,676 KB
testcase_14 AC 31 ms
6,676 KB
testcase_15 AC 98 ms
6,676 KB
testcase_16 AC 242 ms
6,676 KB
testcase_17 AC 361 ms
6,676 KB
testcase_18 AC 389 ms
6,676 KB
testcase_19 AC 223 ms
6,676 KB
testcase_20 AC 299 ms
6,676 KB
testcase_21 AC 405 ms
6,676 KB
testcase_22 AC 371 ms
6,676 KB
testcase_23 AC 173 ms
6,676 KB
testcase_24 AC 390 ms
6,676 KB
testcase_25 AC 289 ms
6,676 KB
testcase_26 AC 203 ms
6,676 KB
testcase_27 AC 107 ms
6,676 KB
testcase_28 AC 231 ms
6,676 KB
testcase_29 AC 190 ms
6,676 KB
testcase_30 AC 175 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

fn main() {
    let mut n = read!(usize);

    let mut v = vec![];
    for i in 2..=n {
        let mut cnt = 0;
        while n % i == 0 {
            n /= i;
            cnt += 1;
        }
        if cnt != 0 {
            v.push(cnt);
        }
    }

    if v.iter().fold(0, |a, b| a ^ b) == 0 {
        println!("Bob");
    } else {
        println!("Alice");
    }
}
0