比赛 20110928 评测结果 AWAAAWAWWW
题目名称 拱猪计分 最终得分 50
用户昵称 TBK 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2011-09-28 19:40:10
显示代码纯文本
#include <fstream>
#include <string>
using namespace std;
string str;
int a,b,c,d,e,k,l,m,r[4]={0};
bool bo[4][13]={false};
int main(void)
{
	ifstream fin("heart.in");
	ofstream fout("heart.out");
	while (!fin.eof())
	{
		for (a=0;a<4;a++) r[a]=0;
		for (a=0;a<13;a++) bo[0][a]=false;
		for (a=0;a<13;a++) bo[1][a]=false;
		for (a=0;a<13;a++) bo[2][a]=false;
		for (a=0;a<13;a++) bo[3][a]=false;
		for (a=0;a<4;a++)
		{
			c=0;
			d=0;
			k=0;
			l=0;
			getline(fin,str);
			m=str.length();
			for (b=0;b<m-1;b++)
			{
				if (str[b]=='S') d++;
				if (str[b]=='C') k++;
				if (str[b]=='D') l++;
				if (str[b]=='H')
				{
					c++;
					if (str[b+1]=='1') 
					{
						if (str[b+2]!=' ') bo[a][10+str[b+2]-'0'-1]=true;
							else bo[a][0]=true;
					}
						else bo[a][str[b+1]-'0'-1]=true;
				}
			}
			if ((c==13)&&(d==1)&&(l==1)) r[a]+=500;
				else 
				{
					if (d==1) r[a]-=100;
					if (l==1) r[a]+=100;
					if (c==13) r[a]+=200;
						else
						{
							for (e=0;e<13;e++)
							if (bo[a][e]==true) 
							{
								if ((e>=1)&&(e<=9)) 
								{
									r[a]-=e;
									r[a]--;
								}
									else 
									{	
										if (e==0) r[a]-=50;
										if (e==10) r[a]-=20;
										if (e==11) r[a]-=30;
										if (e==12) r[a]-=40;
									}
							}
						}
				}
			if (k==1)
			{
				if (r[a]==0) r[a]=50;
					else r[a]*=2;
			}
		}
		for (a=0;a<4;a++)
			if (r[a]!=0) break;
		if (a==4) break;
		for (a=0;a<4;a++) 
		{
			if (r[a]>0) fout<<"+";
			fout<<r[a]<<" ";
		}
		fout<<endl;
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}