Cod sursa(job #1411595)
Utilizator | Data | 31 martie 2015 20:23:26 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<iostream>
#include<fstream>
using namespace std;
int p,p5,n;
int putere5(int x) {
int t=0;
while (x%5==0)
{
t++;
x=x/5;
}
return t;
}
int main(){
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
n=0; p5=0;
while (p5<p) {
n=n+5;
p5=p5+putere5(n);
}
g<<n;
f.close();
g.close();
return 0;
}