FCTRL2 - Small factorials

You are asked to calculate factorials of some small positive integers.

Input

An integer t, 1 ≤ t ≤ 100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1 ≤ n ≤ 100.

Output

For each integer n given at input, display a line with the value of n!

Example

Input:
4
1
2
5
3

Output:
1
2
120
6

Added by:adrian
Date:2004-05-28
Time limit:1s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2014-04-22 01:17:57 Mateus Bezrutchka
Why is source limit so strict? I had to change the names of most of the variables...
2014-03-20 13:50:09 code_new
It's so easy to resolve the problem by using python~lol
2014-03-15 23:27:43 Zeljko Markovic
Can you output in form of an array of digits(output one digit at a time) for every example? Also, why do i get an error on this line:
vlnum () : digit {0} {}
where vlnum is the name of a structure? the code works perfectly in Code::Blocks , and compiles with no problem. please help :)
2014-03-09 12:41:59 shubham sharma
my code is giving upto 200! correctly on my computer, but the judge is giving wrong answer, any ideas?

Last edit: 2014-03-09 12:43:20
2014-03-05 03:42:25 Herman
really nice problem to solve using C or some other language without bignum or biginteger :)
2014-02-26 23:06:40 Nick C
@Mitch Schwartz, I did in fact mean <=100. Also I gave ideone a whirl, output was correct there as well.
2014-02-19 19:09:30 Mitch Schwartz
@Nick C: Have you tested on ideone? Since ideone uses the same engine as SPOJ, you can prevent certain issues like forgetting to change "%I64d" -> "%lld", or assuming "int" is 64-bit instead of 32-bit. You can also try the forum for help with debugging.

Edit: And I'm assuming you meant "less than or equal to 100" instead of "less than 100". :p

Last edit: 2014-02-19 19:36:38
2014-02-19 18:18:38 Nick C
I've tested my program for all values less than 100 and got them all correct. However for some reason on spoj I'm getting a WA.
2014-02-19 07:18:51 TCony
The point of this problem is large number handling. uint32 is not enough. The easiest solutions would be using Java\Ruby, which has native BigInteger\BigNum
2014-02-18 19:09:20 shaleen bakshi
how do i deal with segmentation fault ?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.