Cod sursa(job #1189055)
Utilizator | Data | 21 mai 2014 11:14:19 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream f ("fact.in");
ofstream g ("fact.out");
unsigned p,k,c,cc;
int main()
{
f>>p;
if (p==0) g<<1<<'\n';
else
{
k=1;
c=5;
while (k<p)
{
cc=c;
while (cc%5==0&&k<p)
{
k++;
cc=cc/5;
}
c+=5;
}
cout<<c;
}
return 0;
}