Cod sursa(job #2674696)
Utilizator | Data | 19 noiembrie 2020 20:29:40 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream>
#include<math.h>
using namespace std;
ifstream f ("fact.in");
ofstream g("fact.out");
int p;
int main()
{
int a=p;
f>>p;
if(p%6==5)
{g<<-1;
return 0;}
if(p==0)
{g<<1;
return 0;}
while(a>9)
a=a/10;
g<<p*5-(p/6)*pow(5,a);
return 0;
}