結果
問題 | No.2021 Not A but B |
ユーザー |
👑 |
提出日時 | 2022-07-30 22:29:01 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 33 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 5,696 KB |
最終ジャッジ日時 | 2024-07-20 19:08:25 |
合計ジャッジ時間 | 1,465 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
local n = io.read("*n", "*l")local s = io.read()local ret, t = 0, {}local org = falsefor i = 1, n - 1 dolocal a = s:sub(i, i) == "A"local b = s:sub(i + 1, i + 1) == "A"if a and b thenret = ret + 1elseif a thent[i] = trueelseif b thent[i + 1] = trueelseorg = trueendendif org then ret = ret + 1 endfor k, v in pairs(t) do ret = ret + 1 endprint(ret)