Cod sursa(job #801531)
Utilizator | Data | 24 octombrie 2012 17:12:02 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<fstream>
#include<math.h>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
long long p,x=5,n,s;
int main()
{
in>>p;
n=5*p-1;
while (x<n)
{
x*=5;
s+=n/x;out<<"**"<<n<<'\n';
}
n-=5*s-1;
if (p>0)
out<<n;
else
out<<"1";
in.close();
out.close();
return 0;
}