Cod sursa(job #3137217)
Utilizator | Data | 11 iunie 2023 17:36:45 | |
---|---|---|---|
Problema | Factorial | Scor | 75 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <bits/stdc++.h>
#define L long long
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
L x,i,c,t;
int main()
{
in>>x;
for(i=5;i;i+=5)
{
c=i;
while(c%5==0)
c/=5,++t;
if(t==x)
{
out<<i;
return 0;
}
else if(t>x)
{
out<<-1;
return 0;
}
}
}