結果

問題 No.2323 Nafmo、A+Bをする
ユーザー 👑 obakyan
提出日時 2023-05-28 16:34:46
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 11:35:20
合計ジャッジ時間 1,242 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

a = io.read():reverse()
b = io.read():reverse()
if #a < #b then
  a = a .. string.rep("0", #b - #a)
elseif #b < #a then
  b = b .. string.rep("0", #a - #b)
end
mul = 1
ans = 0
for i = 1, #a do
  if a:byte(i) ~= b:byte(i) then ans = ans + mul end
  mul = mul * 2
end
print(ans)
0