Cod sursa(job #1876201)

Utilizator Andrei01Dalinesc Andrei Aurelian Andrei01 Data 12 februarie 2017 01:32:40
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p,n;
long long o_o(int a)
{
    if(a==1)
        return 1;
    else
        return a*o_o(a-1);
}
int main()
{
    f>>p;
    n=1;
    long long c=pow(10,p);
    cout<<c<<" ";
    while(o_o(n)%c!=0)
        {cout<<" "<<o_o(n);n++;}
    g<<n-1;
    f.close();
    g.close();
    return 0;
}