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-07-18 19:33:46 Michael Moerschell
9 lines of Python code... :) -> 0.12s

Last edit: 2014-07-18 19:34:18
2014-07-03 01:18:07 Anupam Rastogi
Nailed it!Very Good problem.
2014-06-22 02:33:03 Alex Tran
make a list of constants from 0 to 100 would help..
<snip>
... but the code will be too big and not accepted..


Last edit: 2022-09-17 23:11:49
2014-06-10 21:12:38 Abhijeet Dubey
finally got it right...they call it small factorials...phew...
2014-06-10 14:21:52 agaurav77
Phew, finally AC! My code worked for all the cases except N=100 (I don't know why). It gave the third last digit in 100! as 8 (??). Just handled that case.

Just use array of ints in C, and check your output at ideone. Your computer might give a different answer. Atleast check for n=100

Last edit: 2014-06-10 14:22:14
2014-05-29 04:20:16 അഭി
Source limit of 2000B is so strict. I had to delete all the comments to get my code to submit
2014-05-22 19:34:47 Wasim Thabraze
Finally AC after two TLE's!

Last edit: 2014-07-01 18:41:51
2014-05-22 00:18:54 HARSH
Nice problem learn't how to deal with large no.
2014-05-14 18:49:46 pvkcse
tried tried and tried with c# and finally got solution in c...really a good problem taught me how to handle big integers in c and c++ other than java...
2014-05-08 19:24:03 pvkcse
used c# and got output in my system...but here in spoj i have got WA...don't know what the reason is...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.