結果
問題 | No.64 XORフィボナッチ数列 |
ユーザー |
|
提出日時 | 2019-05-01 01:02:47 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 12:02:34 |
合計ジャッジ時間 | 983 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.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, ...) -- https://github.com/justincormack/ljsyscall/blob/master/syscall/bit.lua 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 bxor64(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')))