Cod sursa(job #1106068)

Utilizator stefy9815Nicula Stefan Dorin stefy9815 Data 12 februarie 2014 13:54:09
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,t;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    t=p/5;
    if(p%6==5)
        g<<-1;
    else
        {
            if(p==0)
            g<<1;
        else
        {
            if(p%5!=0)
                g<<(p-t)*5;
            else g<<(p-t+1)*5;
        }
        }
    return 0;
}