結果
| 問題 |
No.87 Advent Calendar Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-03 23:03:09 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 818 bytes |
| コンパイル時間 | 2,289 ms |
| コンパイル使用メモリ | 60,952 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 11:17:58 |
| 合計ジャッジ時間 | 3,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 23 WA * 1 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': return
result = 10 * result + k.ord - '0'.ord
# うるう年以外 : +1 | うるう年 : +2
let n = scan()
proc solve(n:int,start:int=2014,x:int = 0):int =
var x = x
for i in (start+1)..n:
if i mod 4 == 0 :
if i mod 100 == 0 :
if i mod 400 == 0 : x += 2
else: x += 1
else: x += 2
else: x += 1
if x == 7 : result += 1
x = x mod 7
let start = 2800
if n <= start: quit $(solve(n)),0
let ans = 111 + 57 * (n div 400 - 7)
echo ans + solve(n,(n div 400) * 400,4)
# var pre = 0
# for i in countup(2400,100_000,400):
# var next = solve(i)
# echo i,":",next,": +",next - pre
# pre = next