結果

問題 No.1808 Fullgold Alchemist
ユーザー Masaki KitaguchiMasaki Kitaguchi
提出日時 2022-01-15 06:41:39
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 5,272 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-13 08:42:05
合計ジャッジ時間 3,129 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 30 ms
4,380 KB
testcase_06 AC 41 ms
4,380 KB
testcase_07 AC 40 ms
4,380 KB
testcase_08 AC 48 ms
4,376 KB
testcase_09 AC 48 ms
4,376 KB
testcase_10 AC 48 ms
4,376 KB
testcase_11 AC 46 ms
4,376 KB
testcase_12 AC 47 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 45 ms
4,376 KB
testcase_15 AC 45 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 11 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 8 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 14 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n")
local m = io.read("*n")
local a = {}; do
  for i = 1, n do
    a[i] = io.read("*n")
  end
end

local sum = 0; do
  for i = 1, n do
    sum = sum + a[i]
  end
end

local ans = (function ()
  for i = 1, n - 1 do
    local sub = a[i] - math.floor(sum / (m * n)) * m
    local diff = sub > 0 and sub or 0
    a[i + 1] = a[i + 1] + diff
    a[i] = a[i] - diff
  end
  return math.floor(a[1] / m)
end)()

print(ans)
0