比赛 20150714B 评测结果 AAAAAWAAAA
题目名称 拱猪计分 最终得分 90
用户昵称 Athena 运行时间 0.002 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-07-14 11:29:18
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
int myinput(int card[],int number[]){
	int i,n; 
    char s[5];
    for(i=0;i<4;i++){
		cin>>n; 
        number[i]=n; 
        while(n--){
			cin>>s;
            switch(s[0]){
				case 'S':card[13]=i;break; 
                case 'D':card[14]=i;break; 
                case 'C':card[15]=i;break; 
                case 'H':if(s[2]=='\0')
					card[s[1]-'1']=i;
				else
					card[s[2]-'1'+10]=i;
			} 
		} 
	} 
	return number[0]+number[1]+number[2]+number[3]; 
}
int main(){
	freopen ("heart.in","r",stdin);
	freopen ("heart.out","w",stdout);
	int value[15]={-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40,-100,100};
	int card[16],score[4]={0,0,0,0},number[4],i,s,input();
    while(myinput(card,number)){
		for(i=0,s=0;i<13;i++) 
        s=s+card[i]; 
        if(s%13){
			for(i=0;i<15;i++)
            score[card[i]]=value[i]+score[card[i]]; 
		}
            else{
				if(card[0]==card[13]&&card[13]==card[14]) 
					score[card[0]]=500+score[card[0]]; 
				else{
					score[card[0]]=200+score[card[0]];
                    score[card[14]]=value[14]+score[card[14]]; 
					score[card[13]]=value[13]+score[card[13]]; 
				} 
			}
			score[card[15]]+=number[card[15]]==1?50:score[card[15]];
        for(i=0;i<4;i++)
        printf("%s%d%s",score[i]>0?"+":"",score[i],i==3?"\n":" ");
        for(i=0;i<4;i++) 
			score[i]=0; 
	}
    return 0; 
}