QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#756211#9552. The Chariotucup-team3659#WA 18ms10700kbPython3622b2024-11-16 19:22:152024-11-16 19:22:15

Judging History

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

  • [2024-11-16 19:22:15]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:10700kb
  • [2024-11-16 19:22:15]
  • 提交

answer

T = int(input())

def calc(D, X, Y, A, B, C):
    if D <= X: return A
    if D <= X + Y: return A + (D - X) * B
    return A + Y * B + (D - X - Y) * C

for i in range(0, T):
    A, B, C, X, Y, D = map(int, input().split())
    ans1 = calc(D, X, Y, A, B, C)
    t = D % X
    ans2 = D // X * A + min(0 if t == 0 else A, t * B if t <= Y else Y * B + (t - Y) * C, min(D // X * Y, t) * B + ((t - min(D // X * Y, t)) * C))
    t = D % (X + Y)
    ans3 = D // (X + Y) * (A + Y * B) + (min(ans1 if t == D else t * C, calc(t, X, Y, A, B, C), A - B * min(X - t, Y)) if t > 0 else 0)
    print(min(ans1, ans2, ans3))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 10612kb

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
10000000000099799

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 18ms
memory: 10700kb

input:

2077
63 88 64 47 55 88
4 75 38 53 33 41
41 1 28 6 13 100
57 88 77 35 5 48
100 36 97 24 93 87
57 25 26 84 62 18
29 11 33 88 86 71
33 16 7 4 73 68
50 65 72 14 43 78
15 31 72 42 39 29
31 10 76 58 35 89
39 55 99 11 16 82
21 18 57 44 80 16
38 31 99 58 59 69
24 22 69 76 14 83
96 40 56 31 14 36
75 84 27 57...

output:

126
-896
310
114
400
-1493
-158
561
300
-388
62
312
-483
76
48
192
150
130
-5510
636
-4248
-205
112
180
-55
138
36
605
-866
-817
88
-788
285
-5680
330
325
174
128
32
36
-1679
-4374
-1374
24
192
170
17
88
-631
102
140
86
-578
52
-599
-3421
-1360
-357
180
-562
-597
145
-1560
58
-567
-1724
156
70
158
2...

result:

wrong answer 2nd lines differ - expected: '4', found: '-896'