結果

問題 No.1455 拡張ROTN
ユーザー 👑 obakyanobakyan
提出日時 2021-05-25 14:13:13
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 01:29:22
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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