結果

問題 No.1603 Manhattan Social Distance
ユーザー 👑 obakyan
提出日時 2021-07-19 21:40:15
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-17 13:35:59
合計ジャッジ時間 892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, h, w = io.read("*n", "*n", "*n")

local function solve(n, x)
  n = 1LL * n
  x = 1LL * x
  if n % 2LL == 0LL then
    n = n / 2LL
    return n * n * (x - 1LL)
  else
    n = n / 2LL
    return n * (n + 1) * (x - 1LL)
  end
end

local r1 = solve(n, h)
local r2 = solve(n, w)
local ret = tostring(r1 + r2):gsub("LL", "")
print(ret)
0