template times*(n:int,body) = (for _ in 0.." .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc printf(formatstr: cstring){.header: "", varargs.} proc impl() = template OK() = printf("AC\n") return template NG() = printf("ZETUBOU\n") return let d = scan() - 1# 深さ let x = scan() let t = scan() if t == 0: NG() if d == 0: OK() var ans = 1 if x > d: for i in 1..d: ans = ans * (x+i) div i if ans <= t : continue NG() else: for i in 1..x: ans = ans * (d+i) div i if ans <= t : continue NG() OK() let q = scan() q.times: impl()