Submit | All submissions | Best solutions | Back to list |
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
Added by: | adrian |
Date: | 2004-05-28 |
Time limit: | 1s |
Source limit: | 2000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
|
||||||||||||||
2015-05-28 21:15:05
Every other code runs perfectly on ideone but it isn't accepted here. Used a double. Help ! |
||||||||||||||
2015-05-17 17:32:29 shubhi
use this algorithm. http://www.geeksforgeeks.org/factorial-large-number/ |
||||||||||||||
2015-05-04 19:51:28 faiz
very big integer like 100! can be stored in cpp_int in boost::multiprecision in c++ |
||||||||||||||
2015-05-03 13:24:08 subbu
I used double to store the value of integer and removed the decimal points. Works fine on Ideone but wrong answer. Can anyone help? |
||||||||||||||
2015-04-30 12:08:57
Now I find that python is good! |
||||||||||||||
2015-04-27 04:08:37
I submitted two programs, one assuming 0!=1 and one assuming 0!=0. Only the one assuming 0!=0 passed, which is wrong because 0!=1. Also, this is outside of the test case constraints. It explicitly states, "a single integer n, 1<=n<=100" so zero should not exist as a test case Last edit: 2015-04-27 04:35:04 |
||||||||||||||
2015-04-14 08:54:51 Mani
Hi, I wrote java code which is giving correct values but in i64 representation(Eg:2.43290200817664E18) and while submitting it is showing as wrong answer.Can any one please guide me? |
||||||||||||||
2015-04-01 17:38:08 sandy
remember to put \n after printing the ans of any testcase...it costs me two WA.... |
||||||||||||||
2015-03-16 23:50:14 Tony T.
thought this was pretty difficult, even if i read up on how this problem should be tackled |
||||||||||||||
2015-03-15 18:18:09 John Jost
I think the 2000B limit is frustrating and arbitrary. I was basically forced to take my algorithm, remove all the whitespace, and rename all my variables to single char names. Ok, I am now under your size limit but nothing about my program has changed except it's an unreadable mess now. |