Cod sursa(job #1704343)

Utilizator cristi.razvan2015cristi razvan cristi.razvan2015 Data 18 mai 2016 17:08:32
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;

int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    long long p=1,x;
    x=pow(10,8);

    long double n,x1;
    int ok=0,i=1;
    f>>n;
    if(n<=x)
    {

    x1=pow(10,n);
    x=x1;
    while(ok==0)
    {

        if(p>x)
        p=p%x;

        if(p%x==0)
            ok++;
            else
        {
            i++;
            p=p*i;
        }
    }
    g<<i;
    }
    return 0;

}