Cod sursa(job #2616559)
| Utilizator | Data | 18 mai 2020 21:05:08 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<iostream>
#include<fstream>
using namespace std;
fstream fin("fact.in", ios::in);
fstream fout("fact.out", ios::out);
int main()
{
ios::sync_with_stdio(false);
unsigned int p; fin>>p;
if(p == 0)
fout<<1;
else
{
long long unsigned int i = 5;
long long unsigned int counter = 0;
for(;counter < p; i+=5)
{
long long unsigned cop = i;
while(cop % 5 == 0)
{
counter ++;
cop /= 5;
}
//cout<<counter<<"\n";
}
fout<<i - 5;
}
}
