Pagini recente » Cod sursa (job #2767152) | Cod sursa (job #1928258) | Cod sursa (job #452978) | Istoria paginii runda/simulare-cartita-40/clasament | Cod sursa (job #246973)
Cod sursa(job #246973)
#include <iostream.h>
#include <stdio.h>
int main()
{int x=0,v[13],i;
long p,n=0;
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
cin>>p;
if(p==0) {cout<<1; return 0;}
else
{for(i=0;i<13;i++) v[i]=0;
while(x<p)
{++x;
n=n+5; v[0]++;
if(v[0]==5) {v[0]=0; ++v[1];}
if(v[1]==5) {v[1]=0; ++v[2];}
if(v[2]==5) {v[2]=0; ++v[3];}
if(v[3]==5) {v[3]=0; ++v[4];}
if(v[4]==5) {v[4]=0; ++v[5];}
if(v[5]==5) {v[5]=0; ++v[6];}
if(v[6]==5) {v[6]=0; ++v[7];}
if(v[7]==5) {v[7]=0; ++v[8];}
if(v[8]==5) {v[8]=0; ++v[9];}
if(v[9]==5) {v[9]=0; ++v[10];}
if(v[10]==5) {v[10]=0; ++v[11];}
if(v[11]==5) {v[11]=0; ++v[12];}
for(i=0;i<13;i++)
x+=v[i];}
if(x==p) cout<<n;
else cout<<-1;}
fcloseall();
return 0;
}