結果
問題 |
No.201 yukicoderじゃんけん
|
ユーザー |
|
提出日時 | 2020-06-07 17:44:22 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 936 bytes |
コンパイル時間 | 14,124 ms |
コンパイル使用メモリ | 374,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 18:32:01 |
合計ジャッジ時間 | 12,305 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
macro_rules! read { ($x:ident, $v:expr, $idx:expr, $type:ty) => { let $x:$type = $v[$idx].clone().parse().unwrap(); }; ( $($x:ident:$t:ty),* ) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let input:Vec<String> = s.trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect(); let mut idx:i64 = -1; $( idx += 1; read!($x, input, idx as usize, $t); )* }; } fn main() { read!(sa:String, pa:String, _xa:String); read!(sb:String, pb:String, _xb:String); let pa:Vec<i32> = pa.chars().map(|x| x.to_string().parse().unwrap()).collect(); let pb:Vec<i32> = pb.chars().map(|x| x.to_string().parse().unwrap()).collect(); let ans = if pa.len() > pb.len() { sa } else if pa.len() < pb.len() { sb } else if pa > pb { sa } else if pa < pb { sb } else { "-1".to_string() }; println!("{}", ans); }