Cod sursa(job #2987656)
Utilizator | Data | 2 martie 2023 17:45:25 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
using namespace std;
ifstream in ("fact.in");
ofstream out ("fact.out");
int main()
{
long long p,q,cnt=0,i;
in>>p;
for(i=0;i<=10000000;i++)
{
q=5*i;
while(q%5==0)
{
q=q/5;
cnt++;
}
if(cnt==p)
{
out<<i*5;
return 0;
}
else if(cnt>p)
{
out<<-1;
return 0;
}
}
return 0;
}