Cod sursa(job #1599848)
Utilizator | Data | 14 februarie 2016 14:19:41 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
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;
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/5)%5==0 && h/5>0 )k++;
if(k>p){fout<<"-1";break;}
}
if(k==p)fout<<h;
}
return 0;
}