結果

問題 No.657 テトラナッチ数列 Easy
ユーザー nonokai10nonokai10
提出日時 2018-03-11 12:39:40
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 283 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 100,372 KB
最終ジャッジ日時 2024-04-23 01:00:21
合計ジャッジ時間 4,270 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
19,356 KB
testcase_01 AC 75 ms
12,288 KB
testcase_02 AC 75 ms
12,160 KB
testcase_03 AC 77 ms
12,160 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a = []
gets.to_i.times do
  a << gets.to_i
end
def tetra(n)
  a = 0
  b = 0
  c = 0
  d = 1
  e = 0
  case n
  when 1..3
    0
  when 4
    1
  else
    (5..n).each do |i|
      e = a + b + c + d
      a, b, c, d = b, c ,d, e
    end
    e
  end
end
a.each do |i|
  p tetra(i)%17
end
0