Cod sursa(job #1400926)
Utilizator | Data | 25 martie 2015 15:45:45 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <cstdio>
using namespace std;
int main(){
long long int p,i,k,aux;
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%lld",&p);
if(p == 0){
printf("1\n");
}else{
k = 4 * p;
i = 25;
while(k/i != 0){
k = k + k/i;
}
if(k > p){
printf("-1\n");
}else{
printf("%lld\n",k);
}
}
return 0;
}