結果

問題 No.657 テトラナッチ数列 Easy
ユーザー letrangerjpletrangerjp
提出日時 2018-03-02 22:30:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,003 ms / 2,000 ms
コード長 145 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,152 KB
実行使用メモリ 24,572 KB
最終ジャッジ日時 2023-09-03 23:09:42
合計ジャッジ時間 7,341 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,096 KB
testcase_01 AC 78 ms
15,032 KB
testcase_02 AC 78 ms
15,016 KB
testcase_03 AC 79 ms
15,084 KB
testcase_04 AC 890 ms
23,264 KB
testcase_05 AC 115 ms
15,800 KB
testcase_06 AC 77 ms
15,004 KB
testcase_07 AC 77 ms
15,040 KB
testcase_08 AC 963 ms
24,052 KB
testcase_09 AC 117 ms
15,896 KB
testcase_10 AC 123 ms
16,828 KB
testcase_11 AC 123 ms
16,712 KB
testcase_12 AC 206 ms
17,532 KB
testcase_13 AC 1,003 ms
24,520 KB
testcase_14 AC 999 ms
24,456 KB
testcase_15 AC 996 ms
24,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$dp = [0,0,0,1]
Q = gets.to_i
N = $<.map &:to_i

(4...N.max).each{|i|
  $dp[i] = (1..4).map{|j| $dp[i - j]}.sum % 17
}
N.each{|n|
  p $dp[n-1]
}
0