QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#759427#9552. The Chariotucup-team4893RE 0ms0kbPython31.0kb2024-11-18 08:14:362024-11-18 08:14:36

Judging History

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

  • [2024-11-18 08:14:36]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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

output:


result: