結果

問題 No.87 Advent Calendar Problem
ユーザー fine
提出日時 2016-03-25 23:59:36
言語 Ruby
(3.4.1)
結果
AC  
実行時間 95 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-26 06:05:59
合計ジャッジ時間 3,396 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
ans = (n - 2014) / 400 * 57
n = (n - 2014) % 400 + 2014
d = 0
2015.upto(n){|y|
    if y % 400 == 0
        d += 2
    else
        if y % 100 == 0
            d += 1
        else
            if y % 4 == 0
                d += 2
            else
                d += 1
            end
        end
    end
    if d % 7 == 0
        ans += 1
    end
    }
p ans
0