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

hide comments
Alex Tran: 2014-06-22 02:33:03

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
Abhijeet Dubey: 2014-06-10 21:12:38

finally got it right...they call it small factorials...phew...

agaurav77: 2014-06-10 14:21:52

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

Wasim Thabraze: 2014-05-22 19:34:47

Finally AC after two TLE's!

Last edit: 2014-07-01 18:41:51
HARSH: 2014-05-22 00:18:54

Nice problem learn't how to deal with large no.

pvkcse: 2014-05-14 18:49:46

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...

pvkcse: 2014-05-08 19:24:03

used c# and got output in my system...but here in spoj i have got WA...don't know what the reason is...

Mateus Bezrutchka: 2014-04-22 01:17:57

Why is source limit so strict? I had to change the names of most of the variables...

code_new: 2014-03-20 13:50:09

It's so easy to resolve the problem by using python~lol


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