Cod sursa(job #584052)

Utilizator dutzulBodnariuc Dan Alexandru dutzul Data 23 aprilie 2011 19:39:52
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int a,b,p,x,y,n,i,k,ok;
int main()
{
  i=5;
    f>>p;

while (1==1)
    {
        x=i;
     while (x%5==0)
     {
      k=k+1;
      x=x/5;
     }

     if (k==p)  break;
     if (k>p) {ok=1;break;}
     i=i+5;
    }
  if (ok==0)
  {
if (p==0) g<<1; else
g<<i;
  ;} else g<<-1;

  f.close();
  g.close();
    return 0;
}