Cod sursa(job #2469076)
| Utilizator | Data | 6 octombrie 2019 14:57:46 | |
|---|---|---|---|
| Problema | Factorial | Scor | 50 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
using namespace std;
int a[100001];
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
int no=0,a=5,b,c,n,m,p;
fin>>p;
if(p>0)
{while(no<p){
no++;
b=a;
b/=5;
if(b%5==0){
no++;
b/=5;
while(b%5==0) {
b/=5;
no++;
}
}
a+=5;
}
if(no==p)
fout<<a-5;
else fout<<-1;}
else fout<<1;
return 0;
}
