Sign in $ create-account
~/problems ~/discussion ~/contests ~/submission
← ~/problems
P2008

Factorial Modulo

Easy
// Description
Compute n! (n factorial) modulo 1000000007.
// Input
A single integer n (0 <= n <= 10^6).
// Output
The value of n! mod 1000000007.
// Hint
Multiply iteratively, taking the modulus at every step. Note 0! = 1.
// Samples
Sample Input
5
Sample Output
120
// Problem Info
DifficultyEasy
Acceptance60%
Time Limit1000 ms
Memory Limit65536 KB
Accepted6