結果

問題 No.264 じゃんけん
ユーザー tmtm
提出日時 2022-11-16 23:08:40
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 1,025 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 172,096 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 20:23:05
合計ジャッジ時間 1,677 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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().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