結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
nobigomu
|
| 提出日時 | 2018-03-29 01:30:56 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 361 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-25 12:13:25 |
| 合計ジャッジ時間 | 1,085 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
print((function (f, s)
return f(s)
end)(function (s)
local n,a,b,c = #s+1,1,1,1
while true do
a = s:find("c", a)
if a == nil then break end
b = s:find("w", a)
if b == nil then break end
c = s:find("w", b+1)
if c == nil then break end
if c-a+1 < n then n = c-a+1 end
a = a+1
end
if n > #s then n = -1 end
return n
end, io.stdin:read("*l")))
nobigomu