Cod sursa(job #1466255)
Utilizator | Data | 28 iulie 2015 20:16:00 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long n,p;
int main()
{
fin>>p;
int x;
int c;
c=log(5*p)/log(5);
if(c>=2)
n=5*p-(c+1)*c/2-c;
else
if(p==0)n=1;
else
n=5*p;
fout<<n;
return 0;
}