Cod sursa(job #1817413)

Utilizator prisacalexandruPrisac Alexandru prisacalexandru Data 27 noiembrie 2016 19:39:23
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.71 kb
#include<bits/stdc++.h>

using namespace std;

int p,rez=0,k=0;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    cin>>p;
    //if(p%6==0) {
	//	for(int i=2;i<=p;i++)
    //    if(i%6==0) k++;
    //    rez=5*p-5*k;
    //}
    // else if((p+1)%6==0) rez=-1;
    // else {
    //    for(int i=1;i<=p;i++)
    //    if(i%6==0) k++;
    //    rez=5*p-5*k;
    // }
    for(int i=1;i<=p;i++)
     if(i%6==0) rez=25*p/6;
      else if(i%6==1) rez=25*p/6+5;
       else if(i%6==2) rez=25*p/6+10;
        else if(i%6==3) rez=25*p/6+15;
         else if(i%6==4) rez=25*p/6+20;
          else rez=-1;
    cout<<rez;
return 0;
}