FACTMUL - Product of factorials
You need to find the product of first n factorials 1! * 2! * ... * n! modulo 109546051211.
Input
One integer n (1 <= n <= 10000000)
Output
The answer.
Example
Input:
5
Output:
34560
hide comments
Maroof:
2015-05-24 18:33:43
same code gives WA in C++ and gets AC in python. Why is this Happening ? |
|
MaHmOuD.:
2015-02-11 09:38:20
What's the answer of n = 1000000? |
|
gamer496:
2015-02-10 23:08:16
In c++ intermediate result can overflow so it is advisable to use mulmod function
|
|
Mercury:
2015-02-05 16:56:31
In C or C++ gave WA and got AC in Python 2.7 with same code.
|
|
Rahul:
2015-02-05 12:00:53
WA in C++, but same code gets accepted in python (:P) |
|
Raj Kumar Chauhan:
2015-02-01 09:30:22
thats nice problem..learn new thing :) |
|
Malinga:
2015-01-09 12:00:15
(n!)%mod=(n*(n-1)!)%mod...rest think. |
|
Sahil Dua:
2014-12-17 22:45:10
A great problem with a very simple hidden logic! :D
|
|
Arpit Gupta:
2014-10-10 18:26:46
yeah! AC 0.00 !!! Can't believe i did that!!!
|
|
rajul:
2014-08-28 07:12:27
just a simple statement can cause TLE... else a piece of cake |
Added by: | Ashot Minasyan |
Date: | 2013-08-20 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |