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

Sample input:
4
1
2
5
3

Sample 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-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...
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...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.