Polynomial on the wrapper!

3

26 votes
Problem

Ram has a candy bar that he really wants to eat. However, there is a polynomial written on the wrapper which he has to solve. If he doesn't , then the candy will no longer be sweet and turn bitter. The question on the wrapper is that if x is the least non negative integer satisfying the polynomial Ax^2+Bx-C>=0, then calculate the factorial of x. Help Ram eat his candy!

Input: The first line contains no. of test cases, followed by A,B and C in the next line.

Output: Print the factorial of x. Format output just as shown.

Constraints:

0<=T<=50

0<=A<=10^5

0<=B<=10^5

0<=C<=10^6

0<=x<=20

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?