Task DescriptionDiscussion (0)
Sample Input:
Sample Output:
Task :: Factorial Fun
n! = 1 × 2 × 3 × . . . × n. Given n, find the last non-zero digit of n!.
INPUT:
Each test case consists of a single line containing n, 1<=n<=1 000 000.
Each test case consists of a single line containing n, 1<=n<=1 000 000.
OUTPUT:
For each test case output a single line with the last non-zero digit of n!.
For each test case output a single line with the last non-zero digit of n!.
Sample Input:
Sample Output:
5
Sample Output:
2
Sample Input:
Sample Output:
10
Sample Output:
8
Sample Input:
12
Sample Output:
6
Submit Solution
Available Languages
Task info
Name: | Factorial Fun |
Time: | 0.25 sec. |
Memory: | 16 MB |
#Tests: | 10 |
AddedBy: | ![]() |
Source: | Tomasz Czajka |
Task Ratings
Difficulty: | 3.2 (30 votes) |
Quality: | 3.7 (22 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
User | Time |
---|---|
Bogtan | 0.002 s. |
RobertGerbicz | 0.003 s. |
samfin | 0.004 s. |
informaticar | 0.004 s. |
ivan100sic | 0.004 s. |
ks08.tsar | 0.005 s. |
dzimiks | 0.005 s. |
cirulapiph | 0.006 s. |
ArminHad | 0.006 s. |
falldown | 0.006 s. |
Solved By