結果

問題 No.64 XORフィボナッチ数列
ユーザー 826814741_6826814741_6
提出日時 2019-03-08 01:43:36
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 635 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 19:32:16
合計ジャッジ時間 1,030 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f, g)
	local a,b,m = g()
	return tostring(m==0 and a or m==1 and b or f(a,b)):sub(1,-3)
end)((function (ffi)
	ffi.cdef 'int scanf(const char *, ...);'
	local C,typeof,bxor = ffi.C,ffi.typeof,bit.bxor
	local p,u = typeof("int64_t[1]"),typeof("union { int64_t n64; int32_t n32[2]; }")
	local a,b,c = p(),p(),p()
	function bxor64(_a, _b, ...)
		local a,b,r = u(_a),u(_b),u()
		r.n32[0],r.n32[1] = bxor(a.n32[0],b.n32[0]),bxor(a.n32[1],b.n32[1])
		if select("#",...)>0 then return f(r.n64, ...) end
		return r.n64
	end
	return bxor64, function () C.scanf("%ld%ld%ld",a,b,c) return a[0],b[0],c[0]%3 end
end)(require'ffi')))
0