Cod sursa(job #1524893)
Utilizator | Data | 14 noiembrie 2015 15:32:30 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
int f(int p){
int x=5;
int z=1;
int y;
while (z!=p){
x=x+5;
y=x;
while (y){
z++;
y=y/5;
if (y%5==0){
z++;
y=y/5;
}
else y=0;
}
}
return x;
}
int main()
{
ifstream in("fact.in");
ofstream out("fact.out");
int p;
in>>p;
out<<f(p);
}