Cod sursa(job #1189056)

Utilizator bt.panteaPantea Beniamin bt.pantea Data 21 mai 2014 11:16:02
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <fstream>
#include <iostream>
using namespace std;
ifstream f ("fact.in");
ofstream g ("fact.out");
unsigned p,k,c,cc;
int main()
{
    f>>p;
    if (p==0) g<<1<<'\n';
    else
    {
        k=1;
        c=5;
        while (k<p)
        {
            cc=c;
            while (cc%5==0&&k<p)
            {
                k++;
                cc=cc/5;
            }
            c+=5;
        }
        g<<c;
    }
    return 0;
}