結果

問題 No.44 DPなすごろく
ユーザー yoza
提出日時 2015-03-31 23:07:40
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 220 bytes
コンパイル時間 3,230 ms
コンパイル使用メモリ 65,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 01:37:37
合計ジャッジ時間 3,844 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, algorithm, math

var
  n = readLine(stdin).parseInt()
  dp = newSeq[int](52)

dp[0] = 1
for i in countup(0, n - 1):
  dp[i + 1] = dp[i + 1] + dp[i]
  dp[i + 2] = dp[i + 2] + dp[i]

echo(dp[n])
0