結果
問題 | No.320 眠れない夜に |
ユーザー |
|
提出日時 | 2019-02-04 00:10:58 |
言語 | Nim (2.2.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 2,265 ms |
コンパイル使用メモリ | 60,976 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 11:19:06 |
合計ジャッジ時間 | 3,582 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 22 WA * 9 |
コンパイルメッセージ
/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 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