結果

問題 No.264 じゃんけん
ユーザー tmtm
提出日時 2022-11-16 23:07:09
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 1,176 ms
コンパイル使用メモリ 171,784 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 20:21:46
合計ジャッジ時間 1,386 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fn main() {
    let x = getline();
    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