結果

問題 No.2 素因数ゲーム
ユーザー ixTL255
提出日時 2023-03-05 18:41:19
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 362 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 13,427 ms
コンパイル使用メモリ 379,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 01:40:26
合計ジャッジ時間 19,216 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unnecessary parentheses around `while` condition
 --> src/main.rs:9:14
  |
9 |         while(n % i == 0) {
  |              ^          ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
9 -         while(n % i == 0) {
9 +         while n % i == 0 {
  |

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut n: usize = n.trim().parse().unwrap();

    let mut ans = 0;
    for i in 2..=n {
        let mut cnt = 0;
        while(n % i == 0) {
            cnt += 1;
            n /= i;
        }
        ans ^= cnt;
    }
    println!("{}",
        if ans == 0 { "Bob" }
        else { "Alice" }
    );
}
0