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
2018-06-29 15:27:24
in c++ , use boost library, and dont forget to choose c++14(gcc6.3) compiler otherwise you will get compiler error
2018-06-16 19:14:06
You can use this algorithm here to solve the problem.
https://www.geeksforgeeks.org/factorial-large-number/
2018-06-13 05:28:57
big numbers=boost library
2018-06-11 11:17:35

C/use concept of multiplication of numbers in array
2018-06-05 02:59:11
If you wanna use dp, don't try it with C++. Use Python, the variable limits are bigger ;)
2018-06-02 15:06:41
AC in one go!!.. :)

Last edit: 2018-06-02 15:07:53
2018-05-20 12:10:17
guys always check for the compiler type like if anyone here uses C then i will tell u C has many compiler types like borland , gcc etc.so i use the gcc and runtime error can only be created because u are using a different compiler .
2018-05-15 23:58:11
its easy if using gmp.h library in C
2018-05-12 21:35:18
i m using array and made my own function to multiply them and it is giving 100! on codeblocks but WA here what should i do?
2018-05-12 07:09:15
I am using double and I get 162 decimal place for 100! but still, I am getting the wrong answer.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.