What is wrong in my solution to FCRLT?

This is my solution for FCTRL CodeChef: Practical coding for everyone
If I give my program Sample Input - It gives me the correct sample output.

But why is this telling me Wrong Anwer(WA) on submission?

My c++ code :

#include
using namespace std;

int main() {
int t;
long long n;
long long zeros = 0;
long long cur_power = 0;
cin >> t ;
while(t–)
{
cin >> n ;
zeros = 0;
cur_power = 5;
while(cur_power < n)
{
zeros = zeros + (n/cur_power)*1ll ;
cur_power *= 5ll ;
}
n=0;
cout << zeros << endl ;

}
return 0;

}

Check your solution for n = 5.
The problem is in the while loop’s condition.

2 Likes

@doubleux Thank you so much. It worked !!