結果

問題 No.320 眠れない夜に
ユーザー むらためむらため
提出日時 2019-02-04 00:10:58
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 666 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 66,388 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 03:25:00
合計ジャッジ時間 4,764 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,376 KB
testcase_32 WA -
testcase_33 AC 2 ms
4,380 KB
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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

const fibs = (proc():seq[int] =
  result = newSeq[int](80)
  result[0] = 1
  result[1] = 1
  for i in 2..<80:
    result[i] = result[i-1] + result[i-2]
)()
let n = scan()
let m = scan()
var should = fibs[n-1]
if should == m : quit "0", 0
var ans = 0
for i in (n-3).countdown(0):
  if should - fibs[i] == 0 :
    ans += 1
    break
  if should - fibs[i] < m : continue
  should -= fibs[i]
  ans += 1
if should != m : quit "-1",0
echo ans
0