Cod sursa(job #2276062)
Utilizator | Data | 4 noiembrie 2018 01:39:41 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <cstdio>
using namespace std;
int main()
{
int p;
FILE *f = fopen("fact.in","r");
FILE *g = fopen("fact.out","w");
fscanf(f,"%i",&p);
if(p != 0)
{
int k = p*5,x = 1;
while((double)k/(5*5*x) > 1)
x ++;
x --;
fprintf(g,"%i",(p - x)*5);
}
else
fprintf(g,"1");
return 0;
}