結果

問題 No.72 そろばん Med
ユーザー nobigomu
提出日時 2018-05-09 11:57:59
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 240 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 5,504 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 12:12:28
合計ジャッジ時間 1,297 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local C = ffi.C
ffi.cdef 'int printf(const char *, ...);'

C.printf("%lu\n", (function (m, n)
	local t=n/2
	return n%2==0 and (((t+2)%m)*(t%m))%m or (((t+3)%m)*(t%m)+1)%m
end)(1000007ULL, io.stdin:read("*n")+0ULL))
0