Cod sursa(job #1207952)
Utilizator | Data | 14 iulie 2014 12:55:42 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
FILE* si=fopen("fact.in","r");
ofstream so;
so.open("fact.out");
int p;
fscanf(si,"%i",&p);
int i,n,cont=0;
for(n=1;;++n)
{
i=n;
while(i%5==0)
{
++cont;
i=i/5;
}
if(cont>=p)
{
so<<n;
break;
}
}
}