Cod sursa(job #1516537)

Utilizator dragos231456Neghina Dragos dragos231456 Data 3 noiembrie 2015 09:44:01
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int p,n,t;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    n=5;
    t=0;
    if(p!=0)
    while(t!=p)
    {
        if(n%5==0) t+=1;
        if(t==p) break;
        else n+=5;
        if (n>33000)
        {
            t=p;
            n=-1;
        }
    }
    else n=1;
    g<<n;
}