結果

問題 No.342 一番ワロタww
ユーザー 👑 obakyanobakyan
提出日時 2019-04-30 15:24:23
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 1,098 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 5,304 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 18:16:14
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

-- "w" = 130 151
local str = io.read()
local t = {}
for i = 1, #str do
  t[i] = str:sub(i, i):byte()
end
local chain = 0
local stpos, edpos = 1
local i = 1
local wlist = {}
local maxchain = 0
while(i < #str) do
  if(t[i] == 130 and t[i + 1] == 151) then
    if(chain == 0) then
      edpos = i - 1
    end
    chain = chain + 1
    i = i + 2
  else
    if(0 < chain) then
      local len = edpos - stpos + 1
      if(0 < len) then
        maxchain = math.max(chain, chain)
        if(wlist[chain] == nil) then wlist[chain] = {} end
        local tmp = {}
        tmp.st = stpos
        tmp.ed = edpos
        table.insert(wlist[chain], tmp)
      end
      stpos = i
      chain = 0
    end
    i = i + 1
  end
end
if(0 < chain) then
  local len = edpos - stpos + 1
  if(0 < len) then
    maxchain = math.max(chain, chain)
    if(wlist[chain] == nil) then wlist[chain] = {} end
    local tmp = {}
    tmp.st = stpos
    tmp.ed = edpos
    table.insert(wlist[chain], tmp)
  end
end
if(maxchain == 0) then print("")
else
  for k, v in pairs(wlist[maxchain]) do
  print(str:sub(v.st, v.ed))
  end
end
0