Cod sursa(job #2211937)

Utilizator nolokDragomir Andrei Theodor Paul nolok Data 12 iunie 2018 15:46:30
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <fstream>
using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main() {
  int n,p,cop,f5,i;
  fin>>p;

  n=5;
  while (1) {
    f5=0;
    for (i=5; i<=n; i+=5) {
      cop=i;
      while (cop>1 && cop%5==0) {
        f5++;
        cop/=5;
      }
    }
    if (f5==p) {
      fout<<n;
       cout<<n;
      return 0;
    }
    n+=5;
  }

}