Cod sursa(job #1561917)
Utilizator | Data | 4 ianuarie 2016 17:56:09 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <stdio.h>
using namespace std;
FILE*f=fopen("fact.in","r");
FILE*g=fopen("fact.out","w");
int main()
{
int p,n,i=5,ok=0,x,s;
fscanf(f,"%d",&p);
while (!ok){
x=i/5; s=0;
while (x){
s+=x;
x/=5;
}
if (s==p) {n=i; ok=1;}
i+=5;
}
fprintf(g,"%d",n);
fclose(f);
fclose(g);
return 0;
}