Cod sursa(job #1038912)
Utilizator | Data | 22 noiembrie 2013 09:55:36 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int p,t;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
t=p/5;
if(p%6==5)
g<<-1;
else
{
if(p==0)
g<<1;
else
{
if(p%5!=0)
g<<(p-t)*5;
else g<<(p-t+1)*5;
}
}
return 0;
}