Cod sursa(job #3161481)
Utilizator | Data | 27 octombrie 2023 11:26:46 | |
---|---|---|---|
Problema | Factorial | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p,x=0;
fin>>p;
int cp=p;
while(p>0)
{
x+=5;
int c=x;
while(c%5==0&&c!=0)
{
c=c/5;
p--;
}
}
if(cp!=0)
{
fout<<x;
}
else
{
fout<<1;
}
return 0;
}