Cod sursa(job #1326986)
| Utilizator | Data | 26 ianuarie 2015 11:50:55 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | procopiu_9_oji2015 | Marime | 0.51 kb |
#include <fstream>
using namespace std;
ifstream fin ("fact.in");
ofstream fout ("fact.out");
int v[200];
int main()
{
long long p , n , fact , i , aux , cnt , k , j ;
fin >> p ;
cnt=0;k=0;
for (n=1;n<=1000000;n++)
{
fact=1;cnt=0;
for (i=1;i<=n;i++)
{
fact*=i;
}
aux=fact;
while (aux%10==0)
{
cnt++;
aux/=10;
}
if (cnt==p) {fout << n ; n=1000001;}
}
return 0;
}
