Mai intai trebuie sa te autentifici.
Cod sursa(job #979374)
Utilizator | Data | 1 august 2013 13:50:20 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.62 kb |
#include<stdio.h>
using namespace std;
int desc(int a)
{
int j,k,i;
j=0;
for(i=1;i<=a;i++)
{
k=i;
while(k%5==0)
{
k=k/5;
j++;
}
}
return j;
}
int main()
{
int p;
FILE *fp;
fp=fopen("fact.in","r");
fscanf(fp,"%d",&p);
int i,y,x;
y=2;
for(i=0;i<=y;i++)
{
y++;
if(desc(i)==p)
{
x=i;
break;
}
}
if(p==0)
{
x=1;
}
FILE *fw;
fw=fopen("fact.out","w");
fprintf(fw,"%d",x);
fclose(fp);
fclose(fw);
}