Cod sursa(job #1830756)
Utilizator | Data | 17 decembrie 2016 07:35:25 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <cstdio>
using namespace std;
FILE *f=fopen("fact.in","r");
FILE *g=fopen("fact.out","w");
int n;
int cifre(int x)
{
int s=0;
while(x)
{
x=x/5;
s+=x;
}
return s;
}
int rez1()
{
int pas=1<<30,r=0;
while(pas!=0)
{
if(cifre(r+pas)<n)
r+=pas;
pas/=2;
}
return r;
}
int main()
{
int x;
fscanf(f,"%d",&n);
x=rez1()+1;
fprintf(g,"%d",x);
return 0;
}