結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー maimai8maimai8
提出日時 2020-07-05 14:23:48
言語 OCaml
(5.1.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 09:06:02
合計ジャッジ時間 960 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

let () =
  let soi n = if n < 10 then "0" ^ string_of_int n else string_of_int n in
  let small = [4; 6; 9; 11] in
  let big = [1; 3; 5; 7; 8; 10; 12] in
  let uru y = if y mod 400 = 0 then true else if y mod 100 = 0 then false else if y mod 4 = 0 then true else false in
  Scanf.scanf "%d/%d/%d\n" @@ fun y m d ->
  let (yy,mm,dd) =
    let d' = d + 2 in
    if d' <= 28 || (d' <= 30 && List.mem m small) || (d' <= 31 && List.mem m big) || (uru y && m = 2 && d' <= 29) then (y,(soi m),(soi d'))
    else if m = 12 && 30 <= d' then ((y+1), (soi 1), (soi (d' mod 31))) 
    else
      (if List.mem m small then (y,(soi (m+1)),(soi (d' mod 30)))
       else if List.mem m big then (y,(soi (m+1)),(soi (d' mod 31)))
       else if uru y then (y,(soi (m+1)),(soi (d' mod 29)))
       else (y,(soi (m+1)),(soi (d' mod 28)))) in
  Printf.printf "%d/%s/%s\n" yy mm dd
0