結果

問題 No.1455 拡張ROTN
ユーザー 👑 obakyan
提出日時 2021-05-25 14:13:13
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 00:05:07
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

local s = io.read()
local n = io.read()
n = lltonumber(n)

local t = {}
local function f()
  for i = 1, #s do
    local ss = s:byte(i)
    if 48 <= ss and ss <= 56 then
      t[i] = string.char(ss + 1)
    elseif ss == 57 then
      t[i] = "CpCzNkSuTbEoA"
    elseif 65 <= ss and ss <= 89 then
      t[i] = string.char(ss + 1)
    elseif ss == 90 then
      t[i] = "A"
    elseif 97 <= ss and ss <= 121 then
      t[i] = string.char(ss + 1)
    elseif ss == 122 then
      t[i] = "a"
    end
  end
  s = table.concat(t)
end

if n <= 10LL then
  while 0LL < n do
    f()
    n = n - 1LL
  end
else
  for i = 1, 10 do
    f()
  end
  n = (n - 10LL) % 26LL
  while 0LL < n do
    f()
    n = n - 1
  end
end
print(s)
0