Pagini recente » Cod sursa (job #74805) | Cod sursa (job #2217615) | Cod sursa (job #341652) | Cod sursa (job #1227920) | Cod sursa (job #2424610)
#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;
}