Cod sursa(job #2076297)
Utilizator | Data | 26 noiembrie 2017 13:52:07 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 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;
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;
}