forked from vfonic/SPOJ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfctrl.cpp
More file actions
56 lines (47 loc) · 958 Bytes
/
fctrl.cpp
File metadata and controls
56 lines (47 loc) · 958 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
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define inf 1000000000
using namespace std;
int main()
{
cin.sync_with_stdio(false);
int t;
cin >> t;
int potencije_broja_pet[13];
int potencija = 1;
for (int i = 0; i < 13; ++i)
{
potencija *= 5;
potencije_broja_pet[i] = potencija;
}
for (int qwertz = 0; qwertz < t; ++qwertz)
{
long long n;
cin >> n;
int i = 0;
while (potencije_broja_pet[i] <= n)
{
++i;
}
int sol = 0;
for (int j = 0; j < i; ++j)
{
sol += n/potencije_broja_pet[j];
}
cout << sol << endl;
}
return 0;
}