Pagini recente » Cod sursa (job #25229) | Cod sursa (job #49352) | Cod sursa (job #2585003) | Cod sursa (job #2681970) | Cod sursa (job #245248)
Cod sursa(job #245248)
#include <fstream.h>
#include <math.h>
int main ()
{long p;
ifstream f("fact.in");
ofstream g ("fact.out");
f>>p;
if (p<5) g<<"1";
else if (p<pow(5,2)) {
g << (p*10)/2-5; }
else if (p<pow (5,3)) {
g << (p*10)/2-5; }
else if (p<pow (5,4)) {
g << (p*10)/2-10; }
else if (p<pow (5,5)) {
g << (p*10)/2-15; }
else if (p<pow (5,6)) {
g << (p*10)/2-20; }
else if (p<pow (5,7)) {
g << (p*10)/2-25; }
else if (p<pow (5,8)) {
g << (p*10)/2-30; }
else if (p<pow (5,9)) {
g << (p*10)/2-35; }
else if (p<pow (5,10)) {
g << (p*10)/2-40; }
else if (p<pow (5,11)) {
g << (p*10)/2-45; }
else g<<"-1";
f.close ();
g.close ();
return 0;
}