QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768185 | #9552. The Chariot | Sunlight9 | WA | 131ms | 10696kb | Python3 | 3.6kb | 2024-11-21 01:44:05 | 2024-11-21 01:44:06 |
Judging History
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
if tmp <= X: ans1 = A
else:
ans1 += tmp // X * A
tmp %= X
if tmp != 0:
if X >= tmp:
ans1 += A
tmp = 0
else:
ans1 += A
tmp -= X
if Y >= tmp:
ans1 += tmp * B
tmp = 0
else:
ans1 += Y * B
tmp -= Y
ans1 += tmp * C
ans2 = A
tmp = D - X
if tmp < 0: ans2 = 10**4200
else:
ans2 += tmp // (X+Y) * (A+B*Y)
tmp %= X+Y
if tmp != 0:
if X >= tmp:
ans2 += A
tmp = 0
else:
ans2 += A
tmp -= X
if Y >= tmp:
ans2 += tmp * B
tmp = 0
else:
ans2 += Y * B
tmp -= Y
ans2 += tmp * C
ans3 = 0
tmp = D
ans3 += tmp // (X+Y) * (A+B*Y)
tmp %= X+Y
if tmp != 0:
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
ans4 = 0
tmp = D
ans4 += tmp // X * A
if tmp % X != 0:
ans4 += A
ans5 = A + B*Y
tmp = D - (X+Y)
if tmp < 0: ans5 = 10**4200
else:
ans5 += tmp // (X+Y) * (A+B*Y)
tmp %= X+Y
if tmp != 0:
if X >= tmp:
ans5 += A
tmp = 0
else:
ans5 += A
tmp -= X
if Y >= tmp:
ans5 += tmp * B
tmp = 0
else:
ans5 += B * Y
tmp -= Y
ans5 += tmp * C
ans6 = A
tmp = D - X
if tmp < 0: ans6 = 10**4200
else:
ans6 += tmp // X * A
tmp %= X
if tmp != 0:
if X >= tmp:
ans6 += A
tmp = 0
else:
ans6 += A
tmp -= X
if Y >= tmp:
ans6 += tmp * B
tmp = 0
else:
ans6 += Y * B
tmp -= Y
ans6 += tmp * C
ans7 = A + B * Y
tmp = D - (X+Y)
if tmp < 0: ans7 = 10*4200
else:
ans7 += tmp // X * A
tmp %= X
if tmp != 0:
if X >= tmp:
ans7 += A
tmp = 0
else:
ans7 += A
tmp -= X
if Y >= tmp:
ans7 += tmp * B
tmp = 0
else:
ans7 += B * Y
tmp -= Y
ans7 += tmp * C
# print(ans)
# print(ans1)
# print(ans2)
# print(ans3)
# print(ans4)
# print(ans5)
ans = min({ans, ans1, ans2, ans3, ans4, ans5, ans6, ans7})
if ans == 672:
print([A,B,C,X,Y,D])
print(ans)
详细
Test #1:
score: 100
Accepted
time: 15ms
memory: 10580kb
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: 131ms
memory: 10696kb
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 [56, 10, 89, 8, 65, 90] 672 76 32 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 20th lines differ - expected: '636', found: '[56, 10, 89, 8, 65, 90]'