Cod sursa(job #1817245)
Utilizator | Data | 27 noiembrie 2016 15:35:26 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include<bits/stdc++.h>
using namespace std;
int p,rez;
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) rez=5*p-5*p/6;
else if((p+1)%6==0) rez=-1;
else rez=5*p;
cout<<rez;
return 0;
}