Cod sursa(job #1876182)

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