結果
問題 | No.64 XORフィボナッチ数列 |
ユーザー |
|
提出日時 | 2019-03-08 01:43:36 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 73 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 14:55:10 |
合計ジャッジ時間 | 697 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
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.bxorlocal 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, ...) endreturn r.n64endreturn bxor64, function () C.scanf("%ld%ld%ld",a,b,c) return a[0],b[0],c[0]%3 endend)(require'ffi')))