Cod sursa(job #1188751)

Utilizator andrey1440Tuiu Andrei andrey1440 Data 20 mai 2014 15:30:55
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
using namespace std;
int n,i,k,m,j,p;
int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>n;
    m=1;j=1;
    if(p==0)g<<1;
    while(p<n)
    {
        while(m%10==0)
        {
            p++;m=m/10;
        }
        m=m%10*j;
        j++;
        if(p==n){j=j-2;g<<j;}
        if(p>n) g<<"-1";
    }
    return 0;
}