Cod sursa(job #250487)
| Utilizator | Data | 30 ianuarie 2009 23:41:49 | |
|---|---|---|---|
| Problema | Factorial | Scor | 15 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <stdio.h>
long p;
int main(void)
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%ld", &p);
if (p==0)
printf("1");
else
{
p=p-p/6-p/31-p/156-p/781-p/3906-p/19531-p/97656-p/488281-p/2441406-p/12207031-p/61035156-p/305175781;
if (p<0)
printf("-1");
else
printf("%ld", p*5);
}
fcloseall();
return 0;
}