Cod sursa(job #1340611)
Utilizator | Data | 11 februarie 2015 22:12:00 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{int p,n,k=2;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p==0)
g<<"1";
else
{n=5*p;
while(pow(5,k)<=n)
{n-=5*(k-1);
k++;}
g<<n;
}
return 0;
}