比赛 20150714B 评测结果 AAAAAAAAAA
题目名称 拱猪计分 最终得分 100
用户昵称 奥、神代号~ 运行时间 0.004 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-07-14 11:05:35
显示代码纯文本
#include<fstream>
    #include<string>
    #include<cstring>
    using namespace std;
    ifstream in("heart.in");
    ofstream out("heart.out");
    string a[20],b[20],c[20],d[20];
    bool q=0,w=0,e=0,r=0;
    bool z=0,x=0,G=0,v=0;
    bool p=0,l=0,m=0,n=0;
    bool woca=0;
    bool flag1=0,flag2=0;
    int sum=0;
    bool temp=0;
    int jishu[15]={-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40};
    int main()
    {
    	int i;
    	int A,B,C,D;
    	int grade=0;
    	int L;
    	while(!in.eof())
    	{
    		in>>A;
    		for(i=1;i<=A;i++)
    		{
    			in>>a[i];
    			if(a[i]=="S12"||a[i]=="D11"||a[i]=="C10"||a[i][0]=='H')
    				z=1;
    			if(a[i][0]=='H')
    				sum++;
    		}
    		if(sum==13)
    			q=1;
    		sum=0;
    		in>>B;
    		for(i=1;i<=B;i++)
    		{
    			in>>b[i];
    			if(b[i]=="S12"||b[i]=="D11"||b[i]=="C10"||b[i][0]=='H')
    				x=1;			
    			if(b[i][0]=='H')
    				sum++;
    		}
    		if(sum==13)
    			w=1;
    		sum=0;
    		in>>C;
    		for(i=1;i<=C;i++)
    		{
    			in>>c[i];
    			if(c[i]=="S12"||c[i]=="D11"||c[i]=="C10"||c[i][0]=='H')
    				G=1;			
    			if(c[i][0]=='H')
    				sum++;
    		}
    		if(sum==13)
    			e=1;
    		sum=0;
		in>>D;
    		for(i=1;i<=D;i++)
    		{
    			in>>d[i];
    			if(d[i]=="S12"||d[i]=="D11"||d[i]=="C10"||d[i][0]=='H')
    				v=1;			
    			if(d[i][0]=='H')
    				sum++;
    		}
    		if(sum==13)
    			r=1;
    		sum=0;
    		if(A==0&&B==0&&C==0&&D==0)
    			break;
    		if(q==0&&w==0&&e==0&&r==0)
    			temp=0;
    		else
    			temp=1;
    		
    		if(A==16)
    		{
    			out<<'+'<<1000<<' '<<0<<' '<<0<<' '<<0<<endl;
    			continue;
    		}
    		if(B==16)
    		{
    			out<<0<<' '<<'+'<<1000<<' '<<0<<' '<<0<<endl;
    			continue;		
    		}
    		if(C==16)
    		{
    			out<<0<<' '<<0<<' '<<'+'<<1000<<' '<<0<<endl;
    			continue;
    		}
    		if(D==16)
    		{
    			out<<0<<' '<<0<<' '<<0<<' '<<'+'<<1000<<endl;
    			continue;
    		}
    		if(z==0)
    			out<<0<<' ';
    		else
    		{
    			for(i=1;i<=A;i++)
    				if(a[i]=="C10")
    				{
    					p=1;
    				    break;
    				}
    			if(p==1&&A==1)
    				out<<'+'<<50<<' ';
    			else
    			{
    			if(temp==1)
    			{
    				for(i=1;i<=A;i++)
    			    {
    				if(a[i]=="S12")
    				{
    					flag1=1;
    					grade+=(-100);
    				}
    				if(a[i]=="D11")
    				{
    					flag2=1;
    					grade+=100;
    				}
    				if(a[i][0]=='H')
    					woca=1;
    				}
    				if(woca==1)
    				{
    					grade+=200;
    					woca=0;
    				}
    				if(p==1)
    					grade=2*grade;
    				if(flag1==1&&flag2==1&&q==1)
    					grade+=500;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    			else
    			{
    				for(i=1;i<=A;i++)
    				{
    					if(a[i][0]=='H')
    					{
    						L=a[i].length();
    						if(L==2)
    						{
    							grade+=jishu[int(a[i][1])-49];
    						}
    						else
    						{
    							if(a[i][2]=='0')
    								grade+=jishu[9];
    							if(a[i][2]=='1')
    								grade+=jishu[10];
    							if(a[i][2]=='2')
    								grade+=jishu[11];
    							if(a[i][2]=='3')
    								grade+=jishu[12];
    						}
    					}
    					if(a[i]=="S12")
    						grade+=(-100);
    					if(a[i]=="D11")
    						grade+=100;
    				}
    				if(p==1)
    					grade=2*grade;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    		}	}		grade=0; flag1=0; flag2=0;

    		if(x==0)
    			out<<0<<' ';
    		else
    		{
    			for(i=1;i<=B;i++)
    				if(b[i]=="C10")
    				{
    					l=1;
    				    break;
    				}
    			if(l==1&&B==1)
    				out<<'+'<<50<<' ';
    			else
    			{
    			if(temp==1)
    			{
    				for(i=1;i<=B;i++)
    			    {
    				if(b[i]=="S12")
    				{
    					flag1=1;
    					grade+=(-100);
    				}
    				if(b[i]=="D11")
    				{
    					flag2=1;
    					grade+=100;
    				}
    				if(b[i][0]=='H')
    					woca=1;
    				}
    				if(woca==1)
    				{
    					grade+=200;
    					woca=0;
    				}
    				if(l==1)
    					grade=2*grade;
    				if(flag1==1&&flag2==1&&w==1)
    					grade+=500;
    				if(grade>0)
					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    			else
    			{
    				for(i=1;i<=B;i++)
    				{
    					if(b[i][0]=='H')
    					{
    						L=b[i].length();
    						if(L==2)
    						{
    							grade+=jishu[int(b[i][1])-49];
    						}
    						else
    						{
    							if(b[i][2]=='0')
    								grade+=jishu[9];
    							if(b[i][2]=='1')
    								grade+=jishu[10];
    							if(b[i][2]=='2')
    								grade+=jishu[11];
    							if(b[i][2]=='3')
    								grade+=jishu[12];
    						}
    					}
    					if(b[i]=="S12")
    						grade+=(-100);
    					if(b[i]=="D11")
    						grade+=100;
    				}
    				if(l==1)
    					grade=2*grade;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    		}	}		grade=0; flag1=0; flag2=0;
    		if(G==0)
    			out<<0<<' ';
    		else
    		{
    			for(i=1;i<=C;i++)
    				if(c[i]=="C10")
    				{
    					m=1;
    				    break;
    				}
    			if(m==1&&C==1)
    				out<<'+'<<50<<' ';
    			else
    			{
    			if(temp==1)
    			{
    				for(i=1;i<=C;i++)
    			    {
    				if(c[i]=="S12")
    				{
    					flag1=1;
    					grade+=(-100);
    				}
    				if(c[i]=="D11")
    				{
    					flag2=1;
    					grade+=100;
    				}
    				if(c[i][0]=='H')
    					woca=1;
    				}
    				if(woca==1)
    				{
    					grade+=200;
    					woca=0;
    				}
    				if(m==1)
    					grade=2*grade;
    				if(flag1==1&&flag2==1&&e==1)
    					grade+=500;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    			else
    			{
    				for(i=1;i<=C;i++)
    				{
    					if(c[i][0]=='H')
    					{
    						L=c[i].length();
    						if(L==2)
    						{
    							grade+=jishu[int(c[i][1])-49];
    						}
    						else
    						{
    							if(c[i][2]=='0')
    								grade+=jishu[9];
    							if(c[i][2]=='1')
    								grade+=jishu[10];
    							if(c[i][2]=='2')
    								grade+=jishu[11];
    							if(c[i][2]=='3')
    								grade+=jishu[12];
    						}
    					}
    					if(c[i]=="S12")
    						grade+=(-100);
    					if(c[i]=="D11")
    						grade+=100;
    				}
    				if(m==1)
    					grade=2*grade;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    		}			}grade=0; flag1=0; flag2=0;
    		if(v==0)
    			out<<0<<' ';
    		else
    		{
    			for(i=1;i<=D;i++)
    				if(d[i]=="C10")
    				{
    					n=1;
    				    break;
    				}
    			if(n==1&&D==1)
    				out<<'+'<<50<<' ';
    			else
    			{
    			if(temp==1)
    			{
    				for(i=1;i<=D;i++)
    			    {
    				if(d[i][0]=='H')
    					woca=1;
    				if(d[i]=="S12")
    				{
    					flag1=1;
    					grade+=(-100);
    				}
    				if(d[i]=="D11")
    				{
    					flag2=1;
    					grade+=100;
    				}
    				}
    				if(woca==1)
    				{
    					grade+=200;
    					woca=0;
    				}
    				if(n==1)
    					grade=2*grade;
    				if(flag1==1&&flag2==1&&r==1)
    					grade+=500;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    			else
    			{
    				for(i=1;i<=D;i++)
    				{
    					if(d[i][0]=='H')
    					{
    						L=d[i].length();
    						if(L==2)
    						{
    							grade+=jishu[int(d[i][1])-49];
    						}
    						else
    						{
    							if(d[i][2]=='0')
    								grade+=jishu[9];
    							if(d[i][2]=='1')
    								grade+=jishu[10];
    							if(d[i][2]=='2')
    								grade+=jishu[11];
    							if(d[i][2]=='3')
    								grade+=jishu[12];
    						}
    					}
    					if(d[i]=="S12")
    						grade+=(-100);
    					if(d[i]=="D11")
    						grade+=100;
    				}
    				if(n==1)
    					grade=2*grade;
    				if(grade>0)
    					out<<'+'<<grade<<' ';
    				else
    					out<<grade<<' ';
    			}
    		}	}		grade=0; flag1=0; flag2=0;	
    q=0;w=0;e=0;r=0;
    z=0;x=0;G=0;v=0;
    p=0;l=0;m=0;n=0;
    temp=0; out<<endl;
    	}		
    	return 0;
    }