結果
問題 | No.769 UNOシミュレータ |
ユーザー | phspls |
提出日時 | 2020-02-18 21:45:30 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,011 bytes |
コンパイル時間 | 14,757 ms |
コンパイル使用メモリ | 380,020 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 09:32:40 |
合計ジャッジ時間 | 19,245 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
fn next(n: usize, player: usize, reverse: bool) -> usize { if reverse { (n + player - 1) % n } else { (player + 1) % n } } fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec<usize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n: usize = nm[0]; let m: usize = nm[1]; let mut cards: Vec<isize> = vec![0; n]; let mut reverse: bool = false; let mut player: usize = 0; let mut bombing2: bool = false; let mut bombing4: bool = false; let mut bombing_count: isize = 0; for i in 0..m { println!("{}", player+1); let mut card = String::new(); std::io::stdin().read_line(&mut card).ok(); let card: &str = card.trim(); if bombing2 { match card { "drawtwo" => {}, _ => { bombing2 = false; cards[player] += bombing_count; bombing_count = 0; player = next(n, player, reverse); }, } } if bombing4 { match card { "drawfour" => {}, _ => { bombing4 = false; cards[player] += bombing_count; bombing_count = 0; player = next(n, player, reverse); }, } } if i == m-1 { cards[player] += 1; break; } else { cards[player] += 1; match card { "drawtwo" => { bombing2 = true; bombing_count -= 2; }, "drawfour" => { bombing4 = true; bombing_count -= 4; }, "skip" => { player = next(n, player, reverse); }, "reverse" => { reverse = !reverse; }, _ => {}, } player = next(n, player, reverse); } } println!("{} {}", player+1, cards[player]); }