Cod sursa(job #1460693)
| Utilizator | Data | 13 iulie 2015 16:13:48 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
using namespace std;
int p;
ifstream f("fact.in");
ofstream o("fact.out");
int verif(long long q)
{ int k=0;
long long aux=q;
while(aux%10==0)
{k++;aux=aux/10;}
if(k==p) return 1;
else return 0;
}
int main()
{ int k=0;int z;
f>>p; long long fact=1;
for(long long i=2;i<9999999999;i++)
{fact=fact*i;
if(verif(fact))
{o<<i<<endl; break;}
}
return 0;
}
