結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー xsdxsd
提出日時 2020-06-14 17:40:15
言語 OCaml
(5.1.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 21,704 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 08:55:57
合計ジャッジ時間 1,052 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

Scanf.scanf "%d/%d/%d" (fun y m d ->
    let isleap y = y mod 400 = 0 || (y mod 100 <> 0 && y mod 4 = 0) in
    let days y m =
        if isleap y then [| 31; 29; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31 |].(m - 1)
                    else [| 31; 28; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31 |].(m - 1)
    in
    let d = d + 2 in
    let m, d = if d > days y m then m + 1, d - days y m else m, d in
    let y, m = if m > 12 then y + 1, m - 12 else y, m in
    Printf.printf "%04d/%02d/%02d\n" y m d
)
0