結果
問題 |
No.273 回文分解
|
ユーザー |
👑 |
提出日時 | 2019-05-04 12:21:50 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 5,632 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-13 01:37:39 |
合計ジャッジ時間 | 1,336 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
local s = io.read() local n = #s local function iscyclic(str, beg, ed) local isok = true while(beg <= ed) do if(str:sub(beg, beg) ~= str:sub(ed, ed)) then isok = false break end beg, ed = beg + 1, ed - 1 end return isok end for i = n - 1, 1, -1 do local r = false for j = 1, n + 1 - i do r = iscyclic(s, j, j + i - 1) if(r) then print(i) break end end if(r) then break end end