Cod sursa(job #263089)
Utilizator | Data | 19 februarie 2009 21:51:58 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<fstream>
using namespace std;
int main()
{
long p,i,x=0,l;
ifstream in("fact.in");
ofstream out("fact.out");
in>>p;
while (p/25!=0)
{x=x+125;
i=x;
p=p-28;
while (i%5==0)
{i=i/5;
p--;}}
l=p/6;
if (p%6==0) x=l*25;
else x=l*25+p%5*5;
out<<x;
in.close();
out.close();
return 0;
}