結果
| 問題 | No.405 ローマ数字の腕時計 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-02-03 18:20:50 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 801 bytes | 
| コンパイル時間 | 20,752 ms | 
| コンパイル使用メモリ | 391,148 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-06 19:32:39 | 
| 合計ジャッジ時間 | 12,556 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 | 
ソースコード
fn main() {
    let table = [
        "XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI",
    ];
    let (s1, t) = read_line();
    let cur = get_hour(s1, &table);
    let ans = calc(cur, t);
    println!("{}", table[ans as usize]);
}
fn calc(cur: i32, t: i32) -> i32 {
    ((cur + t) % 12 + 12) % 12
}
fn get_hour(s1: String, table: &[&str; 12]) -> i32 {
    for (time, roma) in table.iter().enumerate() {
        if *roma == s1 {
            return time as i32;
        }
    }
    unreachable!()
}
fn read_line() -> (String, i32) {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace();
    (
        iter.next().unwrap().to_string(),
        iter.next().unwrap().parse::<i32>().unwrap(),
    )
}
            
            
            
        