結果

問題 No.64 XORフィボナッチ数列
ユーザー harhogefooharhogefoo
提出日時 2016-10-06 08:16:41
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 219 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 339,876 KB
最終ジャッジ日時 2024-05-01 13:22:40
合計ジャッジ時間 7,752 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

f0, f1, n = gets.chomp.split(" ").map(&:to_i)
f_ary = Array.new
f_ary.push(f0); f_ary.push(f1)

2.upto(n) do
  f = f_ary[-2] ^ f_ary[-1]
  f_ary.push(f)
end

if n == 0 or n == 1
  puts f_ary[n]
else
  puts f_ary[-1]
end
0