Cod sursa(job #1687963)

Utilizator DaniellDa Vinci Daniell Data 13 aprilie 2016 10:12:49
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <fstream>

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

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

while(k!=p)
{
    h=h+5;k++;
    if(h%25==0 )
     k+=(h/25)*2-1;


}
    if(k>p){fout<<-1;return 0;}
}
fout<<h;

    return 0;
}