QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#769306#9552. The ChariotSunlight9WA 79ms10784kbPython32.1kb2024-11-21 17:03:052024-11-21 17:03:17

Judging History

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

  • [2024-11-21 17:03:17]
  • 评测
  • 测评结果:WA
  • 用时:79ms
  • 内存:10784kb
  • [2024-11-21 17:03:05]
  • 提交

answer

import sys;
input = sys.stdin.readline;

for _ in range(int(input())):
    [a, b, c, x, y, d] = list(map(int, input().split()));

    ans1 = 0;
    t = d;
    if x >= t:
        ans1 += a; t = 0;
    else:
        ans1 += a; t -= x;
    if y >= t:
        ans1 += t * b; t = 0;
    else:
        ans1 += y * b; t -= y;
    ans1 += t * c;

    ans2 = 0;
    t = d;
    ans2 += t // x * a;
    t %= x;
    if t > 0: ans2 += a;

    ans3 = 0;
    t = d;
    ans3 += t // x * a;
    t %= x;
    if y >= t:
        ans3 += t * b; t = 0;
    else:
        ans3 += y * b; t -= y;
    ans3 += t * c;

    ans8 = 0;
    t = d;
    if t <= x: ans8 = a
    else:
        num = t // x;
        ans8 += num * a;
        t %= x;
        if t // y <= num:
            ans8 += t * b;
        else:
            ans8 += num * b;
            t -= num * y;
            ans8 += t * c;

    ans4 = 10*4200;
    t = d
    if t >= x:
        ans4 = a;
        t -= x;
        ans4 += t // (x + y) * (a + y * b);
        t %= x + y;
        if x >= t:
            ans4 += a; t = 0;
        else:
            ans4 += a; t -= x;
        if y >= t:
            ans4 += t * b; t = 0;
        else:
            ans4 += y * b; t -= y;
        ans4 += t * c;

    ans5 = 0;
    t = d;
    ans5 += t // (x + y) * (a + y * b);
    t %= x + y;
    ans5 += t // x * a;
    t %= x;
    if t > 0:
        ans5 += a;

    ans6 = 0;
    t = d;
    ans6 += t // (x + y) * (a + y * b);
    t %= x + y;
    if x >= t:
        ans6 += a; t = 0;
    else:
        ans6 += a; t -= x;
    if y >= t:
        ans6 += t * b; t = 0;
    else:
        ans6 += y * b; t -= y;
    ans6 += t * c;

    ans7 = 10**4200;
    t = d;
    if t >= x + y:
        ans7 += t // (x + y) * (a + y * b);
        t %= x + y;
        ans7 += t * c;

    '''
    print(ans1)
    print(ans2)
    print(ans3)
    print(ans4)
    print(ans5)
    print(ans6)
    print(ans7)
    '''
    
    ans = min({ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8})
    if ans == 27:
        print([a, b, c, x, y, d])
    print(ans)

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 10704kb

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: 79ms
memory: 10784kb

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
4
310
114
400
57
29
561
300
15
62
312
21
76
48
192
150
130
97
636
76
[32, 3, 47, 88, 82, 9]
27
112
180
39
138
36
605
30
23
88
76
285
20
330
325
174
128
32
36
1
36
30
24
192
170
17
88
83
102
140
86
52
81
25
44
8
21
180
49
51
145
55
82
31
85
156
70
158
21
84
48
156
51
145
174
156
86
2
73
83
5
200
...

result:

wrong answer 22nd lines differ - expected: '32', found: '[32, 3, 47, 88, 82, 9]'