Cod sursa(job #2001611)

Utilizator RobertAndruscaAndrusca Robert RobertAndrusca Data 17 iulie 2017 11:02:44
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <bits/stdc++.h>

using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");

int main()
{
 int n, i = 0, j;
 in >> n;
 if(n != 0)
 {
  while(n != 0)
  {
   i += 5;
   j = i;
   while(j % 5 == 0)
   {
     j /= 5;
     n --;
   }
  }
  out << i;
 }
 else out << 1;
 in.close();
 out.close();
    return 0;
}