結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2023-07-17 16:48:46 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 327 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 21:30:07 |
| 合計ジャッジ時間 | 4,037 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
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)