結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー らすたしあんらすたしあん
提出日時 2018-08-03 23:18:55
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 4,465 ms
コンパイル使用メモリ 163,748 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 21:39:57
合計ジャッジ時間 2,031 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 0 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{stdin, Read};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut tok = buf.split_whitespace();
    let mut get = || tok.next().unwrap();
    
    let mut s = get().split('/');
    let mut get = || s.next().unwrap();
    let mut y: i32 = get().parse().unwrap();
    let mut m: i32 = get().parse().unwrap();
    let mut d: i32 = get().parse().unwrap();
    
    d += 2;
    let next_d = match m {
    4|6|9|11 => 30,
    2 => if (y % 4 == 0 && y % 100 != 0) || y % 400 == 0 { 29 } else { 28 },
    _ => 31,
    };
    if d > next_d {
        d -= next_d;
        m += 1;
        if m > 12 {
            m = 1;
            y += 1;
        }
    }
    
    println!("{:4}/{:02}/{:02}", y, m, d);
}
0