結果

問題 No.1486 ロボット
ユーザー 👑 obakyanobakyan
提出日時 2021-04-30 18:55:30
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 19:50:50
合計ジャッジ時間 1,476 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local a, b = io.read("*n", "*n")
local c, d = io.read("*n", "*n")
local e = io.read("*n")
local z1, z2 = 0, 0
local day = 0
local sz = 0
local ret = 0
while true do
  z1, z2 = z1 + 1, z2 + 1
  if a + b < z1 then z1 = 1 end
  if c + d < z2 then z2 = 1 end
  day = day + 1
  if z1 <= a and z2 <= c then
    ret = ret + 1
  end
  if e == day then
    print(ret)
    os.exit()
  end
  if day ~= 1 and z1 == 1 and z2 == 1 then
    sz = day - 1
    ret = ret - 1
    break
  end
end
ret = ret * math.floor(e / sz)
local e = e % sz
day = 0
z1, z2 = 0, 0
while day < e do
  day = day + 1
  z1, z2 = z1 + 1, z2 + 1
  if a + b < z1 then z1 = 1 end
  if c + d < z2 then z2 = 1 end
  if z1 <= a and z2 <= c then
    ret = ret + 1
  end
  if e == day then
    break
  end
end
print(ret)
0