QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#759427 | #9552. The Chariot | ucup-team4893 | RE | 0ms | 0kb | Python3 | 1.0kb | 2024-11-18 08:14:36 | 2024-11-18 08:14:36 |
answer
cnt = 0
def work():
cnt += 1
a,b,c,x,y,d = input().split()
a,b,c,x,y,d = int(a),int(b),int(c),int(x),int(y),int(d)
if cnt == 24:
print(a)
print(b)
print(c)
print(x)
print(y)
print(d)
ans = pow(10, 10000)
ans = min(ans, ((d+x-1)//x) * a)
tmp = d // (x + y)
if d % (x + y) >= x:
ans = min(ans, tmp * (a + y * b) + a + (d % (x + y) - x) * b)
elif tmp * y >= x:
ans = min(ans, tmp * (a + y * b) + a - (x - d % (x + y)) * b)
s = a
d -= x
if d < 0:
print(ans)
return
if d <= y:
ans = min(ans, s + d * b)
print(ans)
return
if d % x <= d // x * y + y :
ans = min(ans, s + (d // x) * a + (d % x) * b)
s += b * y
d -= y
ans = min(ans, s + d * c)
ans = min(ans, s + (d % x) * c + (d // x) * a)
ans = min(ans, s + (d % (x + y)) * c + (d // (x + y)) * (a + y * b))
T = int(input())
for i in range(0, T):
work()
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
5 160 27 41 3 12 3 160 27 41 3 12 4 160 27 41 3 12 99 1 999 999 1 99 999 999 999 1 1 99 9999999999999999