QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783740#9552. The ChariotInkyoWA 11ms10600kbPython3835b2024-11-26 11:36:242024-11-26 11:36:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 11:36:34]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:10600kb
  • [2024-11-26 11:36:24]
  • 提交

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)))
    if 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)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 11ms
memory: 10600kb

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:

160
187
3226
999
9989999999999900199

result:

wrong answer 5th lines differ - expected: '10000000000099799', found: '9989999999999900199'