Cod sursa(job #3236491)
| Utilizator | Data | 29 iunie 2024 01:35:51 | |
|---|---|---|---|
| Problema | Factorial | Scor | 90 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#pragma GCC optimize ("03,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main(int argc, char const *argv[])
{
long long int sol = 0;
int p;
fin>>p;
if( p == 0 )
{
fout<<1;
return 0;
}
for(;p>0;){
sol+=5;
unsigned long long int j=sol;
while(j%5==0){
p--;
j/=5;
}
}
if(p<0)
{
fout<<-1;
return 0;
}
fout<<sol;
return 0;
}
