結果
問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
ユーザー |
![]() |
提出日時 | 2017-02-16 01:09:40 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 915 bytes |
コンパイル時間 | 15,022 ms |
コンパイル使用メモリ | 378,452 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 00:10:36 |
合計ジャッジ時間 | 16,068 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
use std::cmp; fn get_line() -> Vec<String> { let stdin = std::io::stdin(); let mut s = String::new(); loop { stdin.read_line(&mut s).ok(); let s = s.trim(); if s.len() != 0 { // println!("show: {}", s); return s.split_whitespace().map(|s| s.into()).collect(); } } } fn main() { let ref a = get_line()[0]; let ref b = get_line()[0]; let ng = |s : &str| { if !s.chars().all(|c| c.is_digit(10)) { return true; } if s.len() != 1 && s.chars().nth(0) == Some('0') { return true; } return false; }; if ng(&a) || ng(&b) { println!("NG"); return; } let num_a : i32 = a.parse().unwrap(); let num_b : i32 = b.parse().unwrap(); if cmp::max(num_a, num_b) > 12345 { println!("NG"); } else { println!("OK"); } }