QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#812090 | #9552. The Chariot | mmzskm | WA | 23ms | 10468kb | Python3 | 837b | 2024-12-13 11:27:21 | 2024-12-13 11:27:21 |
Judging History
answer
def solve():
a,b,c,x,y,d = map(int, input().split())
if d <= x:
return a
if x < d <= x + y:
r = d // x * a + min(a, (d % x) * b)
if a <= (d % x) * b:
r -= x - d % x
return min(r, a + (d - x) * b)
if d > x + y:
r1 = a + y * b + (d - x - y) * c
r2 = d // x * a + min(a, (d % x) * b)
r3 = d // (x + y) * (a + y * b)
a1 = d % (x + y) * c
a2 = a + max(0, (d % (x + y) - x)) * b
a3 = (d % (x + y)) // x * a + min(a, (d % (x + y) % x) * b)
if d % (x + y) // x == 0:
a3 = min(d % (x + y) * c, a)
t = min(a1, a2, a3)
r3 += t
if t == a3:
r3 -= x - (d % (x + y) % x)
return min(r1, r2, r3)
T = eval(input())
for i in range(T):
print(solve())
詳細信息
Test #1:
score: 100
Accepted
time: 9ms
memory: 10444kb
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: 23ms
memory: 10468kb
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:
120 4 310 114 391 57 29 561 300 15 35 312 21 29 -21 166 100 130 97 636 76 32 49 180 39 138 36 603 30 23 88 76 285 20 330 325 174 62 32 36 1 36 30 -48 175 139 17 86 83 102 106 86 52 81 25 44 8 21 166 49 51 139 55 82 31 85 137 69 158 21 84 47 156 51 145 166 135 86 2 73 83 5 118 117 44 -89 152 58 122 2...
result:
wrong answer 1st lines differ - expected: '126', found: '120'