Cod sursa(job #1649604)

Utilizator asavu16Andrei Savu asavu16 Data 11 martie 2016 14:23:07
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>

using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int t;
long long p,i;
bool ok;
int main()
{
    f>>p;
    ok=true;
    if(p>=1&&p<=4)
    {
        ok=false;
        g<<p*4;
    }
            if(ok==true){
    for(i=5;i<=p;i+=10)
    {
        t++;
        if(p==i)
        {
            g<<1;
            ok=false;
        }
        }
    }
    if(ok==true){
        if(p>=6)
            g<<(p*5)-(5*t);}
}