結果

問題 No.44 DPなすごろく
ユーザー iwotiwot
提出日時 2019-12-20 23:18:34
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 273 ms / 5,000 ms
コード長 216 bytes
コンパイル時間 12,937 ms
コンパイル使用メモリ 417,144 KB
実行使用メモリ 52,204 KB
最終ジャッジ日時 2023-09-25 01:39:33
合計ジャッジ時間 19,834 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 272 ms
50,268 KB
testcase_01 AC 270 ms
50,444 KB
testcase_02 AC 269 ms
50,288 KB
testcase_03 AC 273 ms
50,540 KB
testcase_04 AC 268 ms
50,392 KB
testcase_05 AC 269 ms
50,276 KB
testcase_06 AC 269 ms
52,204 KB
testcase_07 AC 266 ms
50,208 KB
testcase_08 AC 271 ms
50,468 KB
testcase_09 AC 270 ms
50,048 KB
testcase_10 AC 271 ms
50,304 KB
testcase_11 AC 265 ms
50,288 KB
testcase_12 AC 272 ms
50,108 KB
testcase_13 AC 266 ms
50,108 KB
testcase_14 AC 266 ms
50,164 KB
testcase_15 AC 264 ms
50,116 KB
testcase_16 AC 265 ms
50,176 KB
testcase_17 AC 269 ms
50,436 KB
testcase_18 AC 269 ms
50,208 KB
testcase_19 AC 265 ms
50,060 KB
testcase_20 AC 266 ms
50,100 KB
testcase_21 AC 266 ms
50,240 KB
testcase_22 AC 267 ms
50,500 KB
testcase_23 AC 268 ms
50,548 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var arr = Array(n+1) { 0L }
    arr[0] = 1
    arr[1] = 1

    for (i in 2..n) {
        arr[i] = arr[i-1] + arr[i-2]
    }

    println(arr[n])
}
0