Cod sursa(job #1268608)
Utilizator | Data | 21 noiembrie 2014 09:07:04 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 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;
in>>p;
x=1;
for(i=1;i<=30;i++) x=x*2;
t=0;
for(i=x;i>0;i=i/2)
{
s=t+x; s1=0;
while(s!=0)
{
s1=s1+(s/5);
s=s/5;
}
if(s1<t)
{
t=t+x;
}
}
out<<t;
return 0;
}