Cod sursa(job #905549)
Utilizator | Data | 5 martie 2013 21:54:44 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.26 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ifstream f("fact.in");
ofstream g("fact.out");
int n,k=5,s=0;
f>>n;
while(k<=n)
{s=s+1;
k=k*5;}
if(k/5==n)
g<<-1;
else
g<<5*(n-s);
f.close();
g.close();
return 0;
}