Cod sursa(job #1326976)
Utilizator | Data | 26 ianuarie 2015 11:45:46 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | procopiu_9_oji2015 | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <cstdio>
using namespace std;
ofstream g("factorial.out");
int k, i, a, n, P;
int main()
{
freopen("factorial.in", "r", stdin);
scanf("%d", &P);
if(P!=0){
while(i<P)
{
n+=5;
a=n;
k=0;
while(a%5==0)
{
k++;
a/=5;
}
i+=k;
}
}
else n=1;
g<<n;
return 0;
}