QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#754401#9552. The Chariot雷神之怒 (Zhuocheng Lin, Peixuan Sun, Haikun Zhao)#Compile Error//C++20912b2024-11-16 14:58:112024-11-16 14:58:11

Judging History

This is the latest submission verdict.

  • [2024-11-16 14:58:11]
  • Judged
  • [2024-11-16 14:58:11]
  • Submitted

answer

def calc(a, b, c, x, y, d):
    p = d // x
    q = d % x
    if q <= y:
        s = q * b
    else:
        s = y * b + (q - y) * c
    return p * a + min(s, a)

def zhk():
    a, b, c, x, y, d = map(int, input().split())
    
    if d <= x:
        print(a)
        return
    
    if a < x * min(b, c):
        print(calc(a, b, c, x, y, d))
        return
    
    if d <= x + y:
        print(min(calc(a, b, c, x, y, d), a + (d - x) * b))
        return
    
    if a + b * y < c * (x + y):
        p = d // (x + y)
        q = d % (x + y)
        if q <= x:
            s = a
        else:
            s = a + (q - x) * b
        print(p * (a + y * b) + min(s, q * c))
        return
    
    print(min(calc(a, b, c, x, y, d), a + y * b + (d - x - y) * c))

def main():
    _ = int(input())
    for _ in range(_):
        zhk()

if __name__ == "__main__":
    main()

Details

answer.code:1:1: error: ‘def’ does not name a type
    1 | def calc(a, b, c, x, y, d):
      | ^~~