Pagini recente » Cod sursa (job #2025865) | Cod sursa (job #3152168) | Cod sursa (job #2986148) | Cod sursa (job #1457570) | Cod sursa (job #1734058)
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p,n,i;
int scadere(int p)
{
int x,y,aux;
x=5;
y=10;
while(x+y<p)
{
aux=y;
y=y+x;
x=aux;
}
return x;
}
int main()
{
fin>>p;
if(p==0)
fout<<1;
else if(p==1)
fout<<5;
else
{
n=p*5;
if(p>=2&&p<=4)
fout<<n;
else if(p>=6)
fout<<n-scadere(p);
}
fin.close();
fout.close();
return 0;
}