QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#754852 | #9552. The Chariot | ucup-team159# | Compile Error | / | / | C++23 | 1.2kb | 2024-11-16 15:57:58 | 2024-11-16 15:58:02 |
Judging History
answer
import math
def solve():
A, B, C, X, Y, W = map(int, input().split())
# no B, C
ans = A * ((W+X-1)//X)
if W <= X:
return ans
# no C, (X, A) better
anum = W // X
r = W % X
canb = anum * Y
if r <= canb:
tmp = anum * A + r * B
ans = min(ans, tmp)
# no C, (X+Y, A+YB) better
q = W // (X + Y)
r = W % (X + Y)
bnum = q * Y
anum = (r+X-1) // X
free = anum * X - r
if free <= bnum:
tmp = q * (A + Y * B) + anum * A - free * B
ans = min(ans, tmp)
if r <= X:
ans = min(ans, q * (A + Y * B) + A)
else:
tmp = q * (A + Y * B) + A + (r - X) * B
ans = min(ans, tmp)
if W <= X + Y:
return ans
W -= X + Y
off = A + Y * B
# C <= B
# (X, A), z(1, C) only
ans = min(ans, W * C + off) # C better
anum = W // X
r = W % X
ans = min(ans, anum * A + r * C + off) # A better
# B <= C
# (X+Y, A+YB), z(1, C) only
q = W // (X + Y)
r = W % (X + Y)
ans = min(ans, q * (A + Y * B) + r * C + off)
return ans
def main():
T = int(input())
for _ in range(T):
print(solve())
if __name__ == "__main__":
main()
详细
answer.code:6:7: error: invalid preprocessing directive #no 6 | # no B, C | ^~ answer.code:12:7: error: invalid preprocessing directive #no 12 | # no C, (X, A) better | ^~ answer.code:20:7: error: invalid preprocessing directive #no 20 | # no C, (X+Y, A+YB) better | ^~ answer.code:41:7: error: invalid preprocessing directive #C 41 | # C <= B | ^ answer.code:42:7: error: invalid preprocessing directive #( 42 | # (X, A), z(1, C) only | ^ answer.code:43:34: error: stray ‘#’ in program 43 | ans = min(ans, W * C + off) # C better | ^ answer.code:46:45: error: stray ‘#’ in program 46 | ans = min(ans, anum * A + r * C + off) # A better | ^ answer.code:48:7: error: invalid preprocessing directive #B 48 | # B <= C | ^ answer.code:49:7: error: invalid preprocessing directive #( 49 | # (X+Y, A+YB), z(1, C) only | ^ answer.code:1:1: error: ‘import’ does not name a type 1 | import math | ^~~~~~ answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’