Cod sursa(job #1268628)
Utilizator | Data | 21 noiembrie 2014 09:53:12 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.62 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
long long int p, s, s1, x,i,t,ok;
in>>p;
x=1;
for(i=1;i<=30;i++) x=x*2;
t=0; i=64; s=0;
while(i!=0)
{
s=t+i; s1=0;
while(s!=0)
{
s1=s1+(s/5);
s=s/5;
}
if(s1<=p)
{
t=t+i;
}
i=i/2;
}
t=(t/5)*5;
out<<t;
return 0;
}