integer function combination(N,R,T) integer*8::i,j integer*8,intent(in)::N,R,T integer*8::res res = 1 j = N do i=1, R res = (res*j)/i j = j - 1 if(res.gt.T) then combination = 0 return end if end do combination = 1 end function combination program main interface integer function combination(N, R, T) integer*8,intent(in)::N,R,T end function combination end interface type problem integer*8::D,X,T end type problem integer*8::Q,i,j,k,tmp integer*8::qd,qx,qt,qr type(problem)::P(10**4) integer*8::D,T read *, Q read *, P(1:Q) do i=1,Q qd = P(i)%D qx = P(i)%X qt = P(i)%T qr = MIN(qx, qd-1) if(combination(qd+qx-1,qr, qt).eq.0) then print '(a)', "ZETUBOU" else print '(a)', "AC" end if end do end program main