結果

問題 No.87 Advent Calendar Problem
ユーザー むらためむらため
提出日時 2019-02-03 23:03:09
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 818 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 66,524 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 03:23:43
合計ジャッジ時間 3,561 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

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
0