結果
| 問題 | 
                            No.1183 コイン遊び
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2020-09-19 20:15:16 | 
| 言語 | Lua  (LuaJit 2.1.1734355927)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 94 ms / 2,000 ms | 
| コード長 | 377 bytes | 
| コンパイル時間 | 263 ms | 
| コンパイル使用メモリ | 5,632 KB | 
| 実行使用メモリ | 31,140 KB | 
| 最終ジャッジ日時 | 2024-06-23 18:16:23 | 
| 合計ジャッジ時間 | 3,976 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
local n = io.read("*n", "*l")
local a = {}
local b = {}
s = io.read()
for i = 1, n do
  a[i] = s:byte(i * 2 - 1)
end
s = io.read()
for i = 1, n do
  b[i] = s:byte(i * 2 - 1)
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)