結果

問題 No.264 じゃんけん
コンテスト
ユーザー tm
提出日時 2022-11-16 23:08:40
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 1,025 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 823 ms
コンパイル使用メモリ 186,332 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-06 09:37:06
合計ジャッジ時間 1,290 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

pub fn getline() -> String {
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    return a;
}

fn main() {
    let x = getline().trim().to_string();
    let res = func(x);
    println!("{}", res);
}

pub fn func(x: String) -> String{
    let v: Vec<&str> = x.split(" ").collect();
    let a = v[0].parse::<i32>().unwrap();
    let b = v[1].parse::<i32>().unwrap();
    if a == 0 {
        if b == 0 {
            return "Drew".to_string();
        } else if b == 1 {
            return "Won".to_string();
        } else {
            return "Lost".to_string();
        }
    } else if a == 1 {
        if b == 0 {
            return "Lost".to_string();
        } else if b == 1 {
            return "Drew".to_string();
        } else {
            return "Won".to_string();
        }
    } else {
        if b == 0 {
            return "Won".to_string();
        } else if b == 1 {
            return "Lost".to_string();
        } else {
            return "Drew".to_string();
        }
    }
}


0