-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFCTRL.cpp
More file actions
57 lines (48 loc) · 760 Bytes
/
Copy pathFCTRL.cpp
File metadata and controls
57 lines (48 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Author: Srikanth Mujjiga (smujjiga)
Date: 25.Feb.2015
Problem: 11. Factorial http://www.spoj.com/problems/FCTRL/
Problem code: FCTRL
Type: Find # multiples of 5, because 5*even has 0 at the end.
*/
#include <iostream>
using namespace std;
#ifdef _WIN32
inline int getchar_unlocked() { return getchar(); }
inline int putchar_unlocked(char c) { return putchar(c); }
#endif
int main_FCTRL() {
int t;
scanf("%d",&t);
int N;
unsigned long int count;
int f;
while(t--) {
scanf("%d",&N);
count = 0;
f = 5;
while(N/f > 0) {
count+= N/f;
f*=5;
}
printf("%ld\n",count);
}
return 0;
}
/*
Sample Input:
6
3
60
100
1024
23456
8735373
Sample Output:
0
14
24
253
5861
2183837
*/