QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#710684 | #9552. The Chariot | ucup-team1196# | Compile Error | / | / | C++20 | 1.3kb | 2024-11-04 21:00:33 | 2024-11-04 21:00:34 |
Judging History
answer
def main():
for T in range(0, int(input())):
A, B, C, X, Y, D = map(int, input().split(" "))
#ABCCCCCCCCCCC
ans = 0
if D < X:
ans = A
elif D < X + Y:
ans = A + B * (D - X)
else:
ans = A + B * Y + (D - X - Y) * C
# AAAAAAAAAA
cntA = (D + X - 1) // X
ans = min(ans, cntA * A)
# #ABABABABABABABCCC
cntAB = D // (X + Y)
restAB = D - cntAB * (X + Y)
if cntAB >= 1:
ans = min(ans, cntAB * (A + Y * B) + restAB * C)
# AAAAAAAA use B, C to fill the rest
cntA = D // X
restA = D - cntA * X
if restA <= Y * cntA:
ans = min(ans, cntA * A + restA * B)
# # #AAAAAAABCCCCCC
if restA > Y:
ans = min(ans, cntA * A + B * Y + (restA - Y) * C)
#ABABABAb
if X < restAB:
ans = min(ans, cntAB * (A + B * Y) + (restAB - X) * B + A)
else :
ans = min(ans, cntAB * (A + B * Y) + A)
rest = restAB - X
if rest < 0 and cntAB * Y + rest > 0:
ans = min(ans, cntAB * (A + B * Y) + A + B * rest)
print(ans)
if __name__ == "__main__":
main()
詳細信息
answer.code:6:10: error: invalid preprocessing directive #ABCCCCCCCCCCC 6 | #ABCCCCCCCCCCC | ^~~~~~~~~~~~~ answer.code:15:11: error: invalid preprocessing directive #AAAAAAAAAA 15 | # AAAAAAAAAA | ^~~~~~~~~~ answer.code:20:11: error: invalid preprocessing directive ## 20 | # #ABABABABABABABCCC | ^ answer.code:27:11: error: invalid preprocessing directive #AAAAAAAA 27 | # AAAAAAAA use B, C to fill the rest | ^~~~~~~~ answer.code:34:11: error: invalid preprocessing directive ## 34 | # # #AAAAAAABCCCCCC | ^ answer.code:40:10: error: invalid preprocessing directive #ABABABAb 40 | #ABABABAb | ^~~~~~~~ answer.code:2:1: error: ‘def’ does not name a type 2 | def main(): | ^~~