Cod sursa(job #2211974)

Utilizator iramIoana Popa iram Data 12 iunie 2018 17:34:19
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <fstream>
#include <iostream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{
    int n,p,k,r;
    fin>>p;

    if(p==0)
    {
        fout<<1; cout<<1; return 0;
    }
   if(p%6==0)
    {
        k=p/6; fout<<k*5*5; cout<<k*5*5; return 0;
    }
   if((p+1)%6==0)
    {
        k=(p+1)/6; fout<<k*5*5; cout<<k*5*5; return 0;
    }
   r=p%6; k=p/6;  fout<<k*5*5+5*r; cout<<k*5*5+5*r; return 0;
}