結果

問題 No.2209 Flip and Reverse
ユーザー 👑 obakyanobakyan
提出日時 2023-07-17 16:48:46
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 6,448 KB
最終ジャッジ日時 2023-10-18 00:28:20
合計ジャッジ時間 5,166 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 41 ms
5,512 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 65 ms
6,448 KB
testcase_15 AC 65 ms
6,448 KB
testcase_16 AC 78 ms
6,448 KB
testcase_17 AC 66 ms
6,448 KB
testcase_18 AC 64 ms
5,524 KB
testcase_19 AC 76 ms
5,524 KB
testcase_20 AC 65 ms
6,448 KB
testcase_21 AC 64 ms
6,448 KB
testcase_22 AC 66 ms
6,448 KB
testcase_23 AC 62 ms
5,524 KB
testcase_24 AC 56 ms
5,524 KB
testcase_25 AC 57 ms
6,448 KB
testcase_26 AC 56 ms
5,524 KB
testcase_27 AC 53 ms
5,524 KB
testcase_28 AC 42 ms
6,448 KB
testcase_29 AC 42 ms
6,448 KB
testcase_30 AC 40 ms
5,524 KB
testcase_31 AC 42 ms
6,448 KB
testcase_32 AC 39 ms
4,468 KB
testcase_33 AC 40 ms
5,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n", "*l")
local s = io.read()
local t = io.read()
local f = 0
for i = 1, n do
  if s:sub(i, i) == "1" then f = f + 1 end
  if t:sub(i, i) == "1" then f = f + 1 end
end
if f % 2 == 1 then
  s = s:reverse()
end
local c = 0
for i = 1, n do
  if s:sub(i, i) ~= t:sub(i, i) then
    c = c + 1
  end
end
print(c)
0