Cod sursa(job #2076828)
Utilizator | Data | 27 noiembrie 2017 10:39:37 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int main()
{
ifstream fin("fact.in") ;
ofstream fout("fact.out");
int P,pas=1,r,x;
fin>>P;
r=5*P;
while(pas*5<r)
pas*=5;
while(pas>5)
{
r-=(pas/5);
pas/=5;
}
if(r) fout<<r;
else fout<<"1";
return 0;
}