結果
問題 |
No.1183 コイン遊び
|
ユーザー |
👑 |
提出日時 | 2020-09-19 20:14:12 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 536 ms / 2,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 110 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 30,228 KB |
最終ジャッジ日時 | 2024-06-23 18:16:19 |
合計ジャッジ時間 | 13,051 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
local n = io.read("*n", "*l") local a = {} local b = {} s = io.read() for v in s:gmatch("%d") do table.insert(a, tonumber(v)) end s = io.read() for v in s:gmatch("%d") do table.insert(b, tonumber(v)) end local t = {0} for i = 1, n do if a[i] == b[i] then table.insert(t, i) end end table.insert(t, n + 1) c = 0 for i = 1, #t - 1 do if 1 < t[i + 1] - t[i] then c = c + 1 end end print(c)