Cod sursa(job #2001609)

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

using namespace std;
ifstream in("factorial.in");
ofstream out("factorial.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;
}