結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2020-05-28 16:07:30 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 90 ms / 5,000 ms |
コード長 | 255 bytes |
コンパイル時間 | 110 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-10-13 04:13:22 |
合計ジャッジ時間 | 3,219 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'date'N = gets.to_iM = 2015Cycle = 400 * 7def calc(y)a, res = 0, 0y.times do |i|a += Date.leap?(M + i) ? 2 : 1res += 1 if a % 7 == 0endresendyears = N - M + 1ans = calc(Cycle) * (years / Cycle) + calc(years % Cycle)puts ans