Cod sursa(job #2211938)

Utilizator nolokDragomir Andrei Theodor Paul nolok Data 12 iunie 2018 15:49:21
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 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;

    cop=n;
    while (cop>1 && cop%5==0) {
      f5++;
      cop/=5;
    }

    if (f5==p) {
      fout<<n;
       cout<<n;
      return 0;
    }
    n+=5;
  }

}