Cod sursa(job #1516071)
Utilizator | Data | 2 noiembrie 2015 18:03:10 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.58 kb |
# include <iostream>
# include <fstream>
using namespace std;//4 = 24 6=25 7=30; 5-1 10-2 15-3 20-4 25-6 30-7 35-8 40-9 45-10 50-12
ifstream f1 ("fact.in");//i=1 ;5*p=30
ofstream f2 ("fact.out");
int p,i=1,k;
int solutie()
{ if(p*5<5^i)
{
return 0;
}
else
{
i++;
solutie();
}
}
int main()
{
f1>>p;
if (p==0)
f2 <<1;
else
if(p==2)
f2<<10;
else
{solutie();
//cout<<p<<'\n'<<p*5<<'\n'<<i<<'\n'<<p*5-(5*i);
f2<<p*5-(5*i);}
return 0;
}