Pagini recente » Rating Mihnea Stiuca (MihneaStiuca) | Cod sursa (job #72486) | Profil GrosuRoxana99 | Cod sursa (job #667225) | Cod sursa (job #681695)
Cod sursa(job #681695)
#include <iostream>
#include <fstream.h>
using namespace std;
int putere(int n, int d) {
int p=0;
while (n>1){
if (n%d==0)p++;
n=n/d;}
return p;}
int main (void) {
ifstream f("fact.in");
ofstream g("fact.out");
int p, n=1, nm=0;
f>>p;
while (nm<p){
if (putere(n,5)>0) nm=nm+putere(n,5);
n++;}
if (n>4) n--;
g<<n;
f.close ();
g.close();}