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
Deepanshu Thakur: 2014-07-30 20:12:22

WA why it is correct <snip>

Last edit: 2022-09-17 23:07:40
Ketan Gupta: 2014-07-28 19:43:02

@Shaurya Dwivedi
You need to think of a data structure that stores so long factorials. You cannot use long long.

Shaurya: 2014-07-25 21:02:16

time limit exceeded.
Any guesses wHAT to do in c to make it more efficient?

[Lakshman]: 2014-07-25 19:00:32

@rahulpasunuri Do you think your code will work for 30? No it will not.

rahulpasunuri: 2014-07-25 13:30:50

can any one tell me.. whats wrong with my code?
<snip>

Last edit: 2022-09-17 23:07:35
arun vinud: 2014-07-20 22:38:06

@Hunter Compile it in ideone.com and see whether it goes through also check for n=100

Hunter: 2014-07-19 16:19:36

help me m...getting the NZec for every submission...help plzzz

Michael Moerschell: 2014-07-18 19:33:46

9 lines of Python code... :) -> 0.12s

Last edit: 2014-07-18 19:34:18
Anupam Rastogi: 2014-07-03 01:18:07

Nailed it!Very Good problem.

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

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