結果

問題 No.201 yukicoderじゃんけん
ユーザー
提出日時 2024-05-16 15:48:52
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 643 bytes
コンパイル時間 13,147 ms
コンパイル使用メモリ 401,812 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 10:58:26
合計ジャッジ時間 14,334 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let v: Vec<_> = s.split_whitespace().collect();
	match v {
		v if v[1] == v[4] => println!("-1"),
		v if v[1].len() > v[4].len() => println!("{}", v[0]),
		v if v[1].len() < v[4].len() => println!("{}", v[3]),
		_ => {
			for c in v[1]
				.chars()
				.flat_map(|c| c.to_digit(10))
				.zip(v[4].chars().flat_map(|c| c.to_digit(10)))
			{
				match c {
					(a, b) if a > b => {
						println!("{}", v[0]);
						break;
					}
					(a, b) if a < b => {
						println!("{}", v[3]);
						break;
					}
					_ => {}
				}
			}
		}
	}
}
0