Reducing time in the following code
I gave this solution at the codechef for the problem code : FCTRL.
I saw the compile time of others people using the same the language c ( i
am using c++ gcc 4.8.1) is somewhat less, mine is 0.46s while their is
0.23
Can somebody help me in reducing the time if possible?
#include<iostream>
using namespace std;
int main()
{
long int t,i,temp;
cin>>t;
long int n[t],a[t];
for(i=0;i<t;i++)
{
temp=1;
a[i]=0;
cin>>n[i];
while(temp)
{
temp=n[i]/5;
a[i]+=temp;
n[i]=n[i]/5;
}
}
for(i=0;i<t;i++)
cout<<a[i]<<"\n";
return(0);
}
No comments:
Post a Comment