Cod sursa(job #372089)
Utilizator | Data | 8 decembrie 2009 19:19:38 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fi("fact.in");
ofstream fo("fact.out");
int p,n,i,j,p2;
int main(){
fi>>p;
for(j=p;j<=p*10;j++){
p2=j/5+j/25+j/125+j/625+j/3125+j/15625+j/78125;
if(p==p2) {
n=j;
break;
}
}
fo<<n;
}