結果
| 問題 | No.293 4>7の世界 | 
| コンテスト | |
| ユーザー |  sino | 
| 提出日時 | 2020-04-13 12:24:49 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 2,082 bytes | 
| コンパイル時間 | 22,675 ms | 
| コンパイル使用メモリ | 397,980 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 17:19:58 | 
| 合計ジャッジ時間 | 24,003 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 20 | 
ソースコード
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::collections::HashMap;
use std::collections::HashSet;
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}
fn main() {
    let (a, b) = read!(usize, usize);
    let (a_str, b_str) = (a.to_string(), b.to_string());
    use std::cmp::Ordering::*;
    match a_str.len().cmp(&b_str.len()) {
        Greater => {
            println!("{}", a);
        },
        Less => {
            println!("{}", b);
        },
        Equal => {
            let (a_char, b_char) = (a_str.chars(), b_str.chars());
            for (ac, bc) in a_char.zip(b_char) {
                let ac_d = ac.to_digit(10).unwrap();
                let bc_d = bc.to_digit(10).unwrap();
                
                match (ac_d, bc_d) {
                    (4, 7) => {
                        println!("{}", a);
                        return;
                    },
                    (7, 4) => {
                        println!("{}", b);
                        return;
                    },
                    (x, y) if x > y => {
                        println!("{}", a);
                        return;                        
                    },
                    (x, y) if x < y => {
                        println!("{}", b);
                        return;                        
                    }
                    _ => { continue; }
                }
            }
        }
    }
}
            
            
            
        