Cod sursa(job #306118)
Utilizator | Data | 19 aprilie 2009 20:17:33 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
long i,s,n;
void breakdiv(long x)
{
while(!(x%5))
{s++;x/=5;}
}
int main()
{
in>>n;
if(!n)
{
out<<1;
return 0;
}
else
{
for(i=5; s<n; i+=5)
breakdiv(i);
i-=5;
out<<i;
}
return 0;
}