比赛 |
20110928 |
评测结果 |
WAAWWWAAAW |
题目名称 |
拱猪计分 |
最终得分 |
50 |
用户昵称 |
Truth.Cirno |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-09-28 20:21:53 |
显示代码纯文本
#include <cstdio>
using namespace std;
int n[5]={0},sco[5]={0};
bool hei[5][14]={{0}},hong[5][14]={{0}},mei[5][14]={{0}},fang[5][14]={{0}};
bool checkhong(int x)
{
int i;
bool flag=1;
if (n[x]<13)
flag=0;
for (i=1;flag&&i<=13;i++)
if (hong[x][i]==0)
flag=0;
return(flag);
}
int main(void)
{
freopen("heart.in","r",stdin);
freopen("heart.out","w",stdout);
const int RUL[14]={0,-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40};
int i,j,num;
char ch/*,ch2,ch3,ch4*/;
bool dou=0;
while (0==0)
{
/*assign*/
for (i=1;i<=4;i++)
for (j=1;j<=13;j++)
hei[i][j]=0;
for (i=1;i<=4;i++)
for (j=1;j<=13;j++)
hong[i][j]=0;
for (i=1;i<=4;i++)
for (j=1;j<=13;j++)
mei[i][j]=0;
for (i=1;i<=4;i++)
for (j=1;j<=13;j++)
fang[i][j]=0;
/*assign*/
/*read*/
for (i=1;i<=4;i++)
{
scanf("%d",&n[i]);
for (j=1;j<=n[i];j++)
{
scanf("%*[' ']%c%d",&ch,&num);
if (ch=='S')/*hei[i][]*/
{
hei[i][num]=1;
}
else if (ch=='H')/*hong[i][]*/
{
hong[i][num]=1;
}
else if (ch=='C')/*mei[i][]*/
{
mei[i][num]=1;
}
else/*fang[i][]*/
{
fang[i][num]=1;
}
}
}
/*read*/
/*exit*/
if (n[1]==0&&n[2]==0&&n[3]==0&&n[4]==0)
break;
/*exit*/
/*assign2*/
for (i=1;i<=4;i++)
sco[i]=0;
/*assign2*/
/*work*/
for (i=1;i<=4;i++)
{
if (n[i]==0)
continue;
/*assign3*/
dou=0;
/*assign3*/
if (n[i]==1&&mei[i][10]==1)
sco[i]=50;
else
{
if (mei[i][10]==1)
dou=1;
if (checkhong(i)==1)
{
if (hei[i][12]==1&&fang[i][11]==1)
sco[i]=500;
else
{
sco[i]=200;
if (hei[i][12]==1)
sco[i]-=100;
else if (fang[i][11]==1)
sco[i]+=100;
}
}
else
{
for (j=1;j<=13;j++)
if (hong[i][j])
sco[i]+=RUL[j];
if (hei[i][12]==1)
sco[i]-=100;
else if (fang[i][11]==1)
sco[i]+=100;
}
if (dou)
sco[i]*=2;
}
}
/*work*/
/*print*/
/* if (sco[1]>0)
ch='-';
else
ch='\0';
if (sco[2]>0)
ch2='-';
else
ch2='\0';
if (sco[3]>0)
ch3='-';
else
ch3='\0';
if (sco[4]>0)
ch4='-';
else
ch4='\0';
printf("%c%d %c%d %c%d %c%d\n",ch,sco[1],ch2,sco[2],ch3,sco[3],ch4,sco[4]);
*/
for (i=1;i<=3;i++)
{
if (sco[i]>0)
printf("+%d ",sco[i]);
else
printf("%d ",sco[i]);
}
if (sco[4]>0)
printf("+%d\n",sco[4]);
else
printf("%d\n",sco[4]);
/*print*/
}
fclose(stdin);
fclose(stdout);
return(0);
}