結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー gemmarogemmaro
提出日時 2019-10-23 11:59:46
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 11,188 KB
実行使用メモリ 15,356 KB
最終ジャッジ日時 2023-09-20 09:05:58
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,180 KB
testcase_01 AC 83 ms
15,084 KB
testcase_02 AC 84 ms
15,180 KB
testcase_03 AC 84 ms
15,356 KB
testcase_04 WA -
testcase_05 AC 85 ms
15,260 KB
testcase_06 AC 83 ms
15,148 KB
testcase_07 AC 84 ms
15,088 KB
testcase_08 AC 84 ms
15,100 KB
testcase_09 AC 85 ms
15,092 KB
testcase_10 AC 85 ms
15,236 KB
testcase_11 AC 84 ms
15,152 KB
testcase_12 AC 83 ms
15,252 KB
testcase_13 AC 87 ms
15,128 KB
testcase_14 AC 85 ms
15,148 KB
testcase_15 AC 84 ms
15,304 KB
testcase_16 AC 85 ms
15,304 KB
testcase_17 AC 85 ms
15,172 KB
testcase_18 AC 84 ms
15,040 KB
testcase_19 AC 85 ms
15,312 KB
testcase_20 AC 85 ms
15,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$months = [
  31, 28, 31, 30,
  31, 30, 31, 31,
  30, 31, 30, 31
]

year, month, day = gets.chomp.split('/').map &:to_i
day += 2

# @param int year
# @return bool
def uruh?(year)
  if year % 4 == 0
    if year % 100 == 0 and year % 400 != 0
      return false
    end
  end
  return true
end

if month != 2 or not uruh?(year)
  if day > $months[month - 1]
    day -= $months[month - 1]
    month += 1
  end
else
  if day > 29
    month += 1
    day -= 29
  end
end

if month > 12
  year += 1
  month -= 12
end

puts format("%04d/%02d/%02d", year, month, day)
0