spoj problem solution FCTRL
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int sum=0,x=5;
while(n/x!=0)
{
sum=sum+(n/x);
x=x*5;
}
cout<<sum<<endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int sum=0,x=5;
while(n/x!=0)
{
sum=sum+(n/x);
x=x*5;
}
cout<<sum<<endl;
}
return 0;
}
No comments:
Post a Comment