結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー koba-e964koba-e964
提出日時 2017-09-16 00:13:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 11,440 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-08-07 18:00:51
合計ジャッジ時間 3,010 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
14,992 KB
testcase_01 AC 79 ms
15,072 KB
testcase_02 AC 79 ms
15,260 KB
testcase_03 AC 78 ms
15,080 KB
testcase_04 AC 78 ms
15,212 KB
testcase_05 AC 78 ms
15,280 KB
testcase_06 AC 77 ms
15,140 KB
testcase_07 AC 78 ms
15,296 KB
testcase_08 AC 78 ms
15,216 KB
testcase_09 AC 77 ms
15,100 KB
testcase_10 AC 78 ms
15,212 KB
testcase_11 AC 78 ms
15,224 KB
testcase_12 AC 77 ms
15,108 KB
testcase_13 AC 76 ms
15,264 KB
testcase_14 AC 77 ms
15,104 KB
testcase_15 AC 76 ms
15,264 KB
testcase_16 AC 76 ms
14,992 KB
testcase_17 AC 76 ms
15,128 KB
testcase_18 AC 77 ms
15,024 KB
testcase_19 AC 77 ms
15,080 KB
testcase_20 AC 77 ms
15,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

y, m, d = gets.split('/').map(&:to_i)
date_limit = [nil,
              31,28,31,
              30,31,30,
              31,31,30,
              31,30,31]

if (y % 4 == 0) ^ (y % 100 == 0) ^ (y % 400 == 0)
  date_limit[2] += 1
end

d += 2
if d > date_limit[m]
  d -= date_limit[m]
  m += 1
end

if m >= 13
  m -= 12
  y += 1
end

puts sprintf("%04d/%02d/%02d", y, m, d)
0