Cod sursa(job #1599835)

Utilizator DaniellDa Vinci Daniell Data 14 februarie 2016 14:11:45
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include <fstream>

using namespace std;
int n,p,i,k=0,h,j;
ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{fin>>p;
if(p==0)fout<<"1";
else{

while(k!=p)
{
    h=h+5;
    if(k%5==0 && k>0 )k=k+2;
    else k++;
    if(k>p){fout<<"-1";break;}
}
fout<<h;
}
    return 0;
}