Cod sursa(job #222941)
Utilizator | Data | 26 noiembrie 2008 12:52:50 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream input("factorial.in");
long long int p;
input>>p;
input.close();
long long int n=0,contor=0;
if (p==0) n=1;
while (contor < p)
{
n+=5;
long long int k=n;
while (k%5==0)
{contor++;k/=5;}
}
ofstream output("factorial.out");
output<<n<<endl;
output.close();
return 0;
}