-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathprog2.java
More file actions
33 lines (26 loc) · 772 Bytes
/
prog2.java
File metadata and controls
33 lines (26 loc) · 772 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
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader( new InputStreamReader(System.in));
PrintWriter out = new PrintWriter( new BufferedOutputStream(System.out));
int testcase = Integer.parseInt(in.readLine());
while(testcase-->0){
int n = Integer.parseInt(in.readLine());
int ans = 0;
int k=5;
// K will eventually be greater than n at some point of time
while(n/k>0){
ans+=n/k;
k*=5;
}
out.println(ans);
}
in.close();
out.close();
}
}