結果

問題 No.264 じゃんけん
ユーザー mtwtkman
提出日時 2019-10-13 21:44:37
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 637 bytes
コンパイル時間 13,182 ms
コンパイル使用メモリ 401,224 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-17 16:45:49
合計ジャッジ時間 13,991 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, Read};
use std::collections::HashMap;

fn read_stdin() -> Vec<String> {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).ok();
    buffer.trim().split('\n').map(|s| s.to_string()).collect()
}

fn main() {
    let mut hm = HashMap::new();

    hm.insert("0", "1");
    hm.insert("1", "2");
    hm.insert("2", "0");

    let raw = read_stdin();
    let input: Vec<&str> = raw[0].split(' ').collect();
    let me = &input[0];
    let you = &input[1];
    println!("{}",
        if me == you { "Drew" }
        else if &hm.get(me).unwrap() == &you { "Won" }
        else { "Lost" }
    )
}
0