Cod sursa(job #970674)

Utilizator EhtRalpmetFMI Ardei Claudiu-Alexandru EhtRalpmet Data 7 iulie 2013 15:42:42
Problema Factorial Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");

int n,k=0,a,p,aux;

int main()
{
    f>>p;
    for(a=5;k<p;a+=5)
    {
        aux=a;
        while(aux%5==0)
        {
            aux/=5;
            k++;
        }
    }
    if(a==5)
        g<<1;
    else
        g<<a-5;


    return 0;
}