Cod sursa(job #981650)

Utilizator junkieSmerica Valeriu junkie Data 7 august 2013 17:47:19
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.28 kb
#include<fstream>
using namespace std;
int main()
{
   int c=0,z=1;
   unsigned long long p,i;
   ifstream f("fact.in");
   f>>p;f.close();
   i=5*p;
   for(int j=25;j<=i;j*=5){c+=z;z++;}
   i-=5*c;
   ofstream g("fact.out");
   if(!p)g<<1;
   else g<<i;g.close();
}