Cod sursa(job #1704324)

Utilizator cristi.razvan2015cristi razvan cristi.razvan2015 Data 18 mai 2016 16:46:44
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 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;
    double n,x1;
    int ok=0,i=1;
    f>>n;
    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;

}