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
hide comments
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 |
|
Zeljko Markovic:
2014-03-15 23:27:43
Can you output in form of an array of digits(output one digit at a time) for every example? Also, why do i get an error on this line:
|
|
shubham sharma:
2014-03-09 12:41:59
my code is giving upto 200! correctly on my computer, but the judge is giving wrong answer, any ideas? Last edit: 2014-03-09 12:43:20 |
|
Herman:
2014-03-05 03:42:25
really nice problem to solve using C or some other language without bignum or biginteger :) |
|
Nick C:
2014-02-26 23:06:40
@Mitch Schwartz, I did in fact mean <=100. Also I gave ideone a whirl, output was correct there as well. |
|
Mitch Schwartz:
2014-02-19 19:09:30
@Nick C: Have you tested on ideone? Since ideone uses the same engine as SPOJ, you can prevent certain issues like forgetting to change "%I64d" -> "%lld", or assuming "int" is 64-bit instead of 32-bit. You can also try the forum for help with debugging.
|
|
Nick C:
2014-02-19 18:18:38
I've tested my program for all values less than 100 and got them all correct. However for some reason on spoj I'm getting a WA. |
|
TCony:
2014-02-19 07:18:51
The point of this problem is large number handling. uint32 is not enough. The easiest solutions would be using Java\Ruby, which has native BigInteger\BigNum |
|
shaleen bakshi:
2014-02-18 19:09:20
how do i deal with segmentation fault ? |
Added by: | adrian |
Date: | 2004-05-28 |
Time limit: | 1s |
Source limit: | 2000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |