QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#768124#9553. The HermitSunlight9RE 0ms0kbPython31.3kb2024-11-21 00:48:572024-11-21 00:48:57

Judging History

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

  • [2024-11-21 00:48:57]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-21 00:48:57]
  • 提交

answer

import sys
input = sys.stdin.readline

for _ in range(int(input())):
    [A,B,C,X,Y,D] = list(map(int, input().split()))
    ans = 0
    tmp = D
    if X >= tmp:
        ans += A
        tmp = 0
    else:
        ans += A
        tmp -= X
    if Y >= tmp:
        ans += tmp * B
        tmp = 0
    else:
        ans += Y * B
        tmp -= Y
    ans += tmp * C
    
    ans1 = 0
    tmp = D
    ans1 += tmp // X * A
    tmp %= X
    if Y >= tmp:
        ans1 += tmp * B
        tmp = 0
    else:
        ans1 += Y * B
        tmp -= Y
    ans1 += tmp * C
    
    # ans2 = Y * B
    # tmp = D - Y
    # if tmp >= 0:
    #     ans2 += tmp // X * A
    #     tmp %= X
    #     if Y >= tmp:
    #         ans2 += tmp * B
    #         tmp = 0
    #     else:
    #         ans2 += Y * B
    #         tmp -= Y
    #     ans2 += tmp * C
    # else:
    #     ans2 = 10**4200
    
    ans3 = 0
    tmp = D
    ans3 += tmp // (X+Y) * (A+B*Y)
    tmp %= X+Y
    if X >= tmp:
        ans3 += A
        tmp = 0
    else:
        ans3 += A
        tmp -= X
    if Y >= tmp:
        ans3 += tmp * B
        tmp = 0
    else:
        ans3 += Y * B
        tmp -= Y
    ans3 += tmp * C
    
    # print(ans)
    # print(ans1)
    # print(ans2)
    # print(ans3)
    ans = min({ans, ans1, ans3})
    print(ans)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

4 3

output:


result: