結果
問題 | 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 = #slocal function iscyclic(str, beg, ed)local isok = truewhile(beg <= ed) doif(str:sub(beg, beg) ~= str:sub(ed, ed)) thenisok = false breakendbeg, ed = beg + 1, ed - 1endreturn isokendfor i = n - 1, 1, -1 dolocal r = falsefor j = 1, n + 1 - i dor = iscyclic(s, j, j + i - 1)if(r) then print(i) break endendif(r) then break endend