結果

問題 No.1183 コイン遊び
コンテスト
ユーザー obakyan
提出日時 2020-09-19 20:14:12
言語 Lua
(LuaJit 2.1.1774638290)
コンパイル:
luajit -b _filename_ a.out
実行:
luajit _filename_
結果
AC  
実行時間 489 ms / 2,000 ms
コード長 407 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 63 ms
コンパイル使用メモリ 7,976 KB
実行使用メモリ 30,436 KB
最終ジャッジ日時 2026-03-08 22:09:37
合計ジャッジ時間 12,428 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0