Cod sursa(job #2424610)
| Utilizator | Data | 23 mai 2019 14:54:29 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
long long n,dif=0,p=0,aux,cnt=0;
bool ok=false;
bool ok2;
f>>n;
while(dif<n)
{ if(!ok2)ok2=true;
dif++;aux=dif;
if(aux%5==0){aux/=5;p++;ok=true;}
cnt=cnt+5;
if(ok){ok=false;cnt=cnt-p*5;p=0;ok2=false;}
}
if(ok2)g<<cnt;
else g<<-1;
return 0;
}
