Problem H
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 6 Accepted Submission(s) : 2
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Input
There is a single positive integer T on the first line of input. It stands for the number of numbers to follow. Then there is T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.
Output
For every number N, output a single line containing the single non-negative integer Z(N).
Sample Input
6 3 60 100 1024 23456 8735373
Sample Output
0 14 24 253 5861 2183837 #include<iostream>
#include<stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int sum,t,x,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&x);
j=5;sum=0;
while(x/j!=0)
{
sum+=x/j;
j*=5;
}
printf("%d\n",sum);
}
return 0;
}