結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
purple_jwl
|
| 提出日時 | 2016-10-29 10:24:22 |
| 言語 | Scala(Beta) (3.6.2) |
| 結果 |
AC
|
| 実行時間 | 895 ms / 5,000 ms |
| コード長 | 303 bytes |
| コンパイル時間 | 8,130 ms |
| コンパイル使用メモリ | 267,472 KB |
| 実行使用メモリ | 62,876 KB |
| 最終ジャッジ日時 | 2024-06-29 19:45:47 |
| 合計ジャッジ時間 | 30,952 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
import scala.io.StdIn
object Main {
def main(args: Array[String]): Unit = {
val n = StdIn.readInt
val dp: Array[Long] = Array.fill(n + 1)(0)
dp(0) = 1
for (i <- (0 until n); j <- (1 to 2)) {
if (i + j <= n) {
dp(i + j) += dp(i)
}
}
println(dp(n))
}
}
purple_jwl