QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#783725 | #9552. The Chariot | Inkyo | WA | 15ms | 10692kb | Python3 | 802b | 2024-11-26 11:32:11 | 2024-11-26 11:32:13 |
Judging History
answer
t = int(input())
for i in range(t):
a, b, c, x, y, d = map(int, input().split())
def cost(dis):
if dis <= 0:
return 0
elif dis <= x:
return a
elif dis <= x + y:
return a + (dis - x) * b
else:
return a + b * y + (dis - x - y) * c
cx = d // x
ans = cx * cost(x) + cost(d % x)
if d % x <= cx * y:
ans = min(ans, cx * cost(x) + d % x * b)
else:
ans = min(ans, cx * cost(x) + cx * y * b + (d % x - cx * y) * c)
cxy = d // (x + y)
ans = min(ans, cxy * cost(x + y) + cost(d % (x + y)))
ans = min(ans, cxy * cost(x + y) + d % (x + y) * c)
cxyp = (d + x + y - 1) // (x + y)
ans = min(ans, cxyp * a + max(d - cxyp * x, 0) * b)
print(ans)
详细
Test #1:
score: 0
Wrong Answer
time: 15ms
memory: 10692kb
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
output:
123 164 3226 999 9989999999999900199
result:
wrong answer 1st lines differ - expected: '160', found: '123'