Cod sursa(job #518510)
Utilizator | Data | 1 ianuarie 2011 16:05:07 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <cstdio>
using namespace std;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int p,x,y=5,t=0;
bool nicht=false;
scanf ("%d",&p);
x=5*p;
while (y<x)
{
y+=6;
t++;
if (x==y)
nicht=true;
}
t--;
t*=5;
x-=t;
if (nicht==false)
printf ("%d",x);
else
printf ("%d",-1);
}