Pagini recente » Cod sursa (job #1030241) | Cod sursa (job #16234) | Cod sursa (job #2663790) | Cod sursa (job #178786) | Cod sursa (job #2197699)
#include <fstream>
#include <iostream>
#include <cmath>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int P;
int N;
void test(int p) {
// naiv
unsigned long long prod = 1;
unsigned long long i = 1;
unsigned long long P = (unsigned long long)pow(10, p);
while (i < 50) {
cout << prod << "\n";
if (prod % P == 0) {
cout << i << "\n";
break;
}
i += 1;
prod *= i;
}
}
void a(int p) {
// testeaza numere din 5 in 5
if (p == 0)
g << 1 << " \n";
else {
int count = 0;
int x, aux;
for (x = 0; count < p;) {
x += 5;
aux = x;
while (aux % 5 == 0) { aux /= 5; count++; }
}
g << x << "\n";
}
}
int main() {
/*cin >> P;
if (P == 1) {
N = 0;
}
cout << N;*/
//test(1);
f >> P;
a(P);
return 0;
}