Cod sursa(job #547091)
Utilizator | Data | 5 martie 2011 21:19:15 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<fstream>
using namespace std;
ifstream in ("fact.in");
ofstream out ("fact.out");
int main (){
int n=5,n1,i=0,p,t;
in>>p;
while(i<p){
n+=20;
i=i+4;
n1=n;
while(n1%5==0){
i++;
n1=n1/5;
}
}
if(n==0)
n++;
if(p!=i)
out<<-1;
else
out<<n;
return 0;
}