結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-03-29 10:37:30 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 357 bytes |
| コンパイル時間 | 384 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 13:36:10 |
| 合計ジャッジ時間 | 1,249 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
n = io.read("*n", "*l")
s = io.read()
cnt = 0
for i = 1, n-2 do
u = string.sub(s, i, i)
if(u == "U") then
diffmax = (n - i) / 2
for d = 1, diffmax do
if(string.sub(s, i + d, i + d) == "M" and string.sub(s, i + 2 * d, i + 2 * d) == "G") then
cnt = cnt + 1
end
end
end
end
print(cnt)