結果

問題 No.492 IOI数列
ユーザー 👑 obakyanobakyan
提出日時 2020-04-22 12:58:49
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 984 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 12:29:49
合計ジャッジ時間 1,054 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  local x0, y0 = x - x1 * 31623, y - y1 * 31623
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end

local function modpow(src, pow)
  local res = 1
  while 0LL < pow do
    if pow % 2LL == 1LL then
      res = bmul(res, src)
      pow = pow - 1LL
    end
    src = bmul(src, src)
    pow = pow / 2LL
  end
  return res
end

local function modinv(src)
  return modpow(src, mod - 2LL)
end

local function lltonumber(str)
  local ret = 0LL
  for i = 1, #str do
    ret = ret * 10LL + str:sub(i, i):byte() - 48
  end
  return ret
end
local n = lltonumber(io.read())
local function solve2()
  local z = n % 11LL
  z = tostring(z):gsub("LL", "")
  z = tonumber(z)
  for i = 2, z do
    io.write("10")
  end
  io.write("1\n")
end
local function solve1()
  local r = modpow(100, n)
  r = bmul(modinv(99), r - 1)
  print(r)
end
solve1()
solve2()
0