比赛 |
20150714B |
评测结果 |
AWAWAWAWWA |
题目名称 |
拱猪计分 |
最终得分 |
50 |
用户昵称 |
NVIDIA |
运行时间 |
0.012 s |
代码语言 |
C++ |
内存使用 |
4.93 MiB |
提交时间 |
2015-07-14 09:51:33 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
using namespace std;
int fenshu(char q[])
{
int qs=0,i,qc=0,qd=0,outh=0,hnum[14];
int fenshu=0;
int H[14]={0,-50,-2,-3,-4,-5,-6,-7,-8,-9,-10,-20,-30,-40};
for(i=0;q[i]!='\0';i++)
{
if(q[i]=='S')
qs=1;
else if(q[i]=='C')
qc=1;
else if(q[i]=='D')
qd=1;
else if(q[i]=='H')
{
outh++;
if(q[i+2]==' '||q[i+2]=='\0')
hnum[outh]=q[i+1]-'0';
else hnum[outh]=10+q[i+2]-'0';
}
}
if(outh==13)
{
fenshu=200;
if(qs&&qd)
fenshu=500;
else if(qs)
fenshu-=100;
else if(qd)
fenshu+=100;
}
else if(0<=outh&&outh<13)
{for(i=1;i<=outh;i++)
fenshu+=H[hnum[i]];
if(qs)fenshu-=100;
if(qd)fenshu+=100;
}
if(qc)
{
if(qs==0&&qd==0&&outh==0)
fenshu=50;
else fenshu*=2;
}
return fenshu;
}
int main()
{
freopen("heart.in","r",stdin);
freopen("heart.out","w",stdout);
char strin[988][998];
int i,j,result[998][998],out=0;
while(1)
{
for(i=0;i<=3;i++)
gets(strin[i]);
if(strin[0][0]=='0'&&strin[1][0]=='0'&&strin[2][0]=='0'&&strin[3][0]=='0') break;
for(i=0;i<=3;i++)
result[out][i]=fenshu(strin[i]);
out++;
}
for(i=0;i<=out-1;i++)
for(j=0;j<=3;j++)
{
if(j<3) (result[i][j]<=0)?printf("%d ",result[i][j]):printf("+%d ",result[i][j]);
else (result[i][j]<=0)?printf("%d\n",result[i][j]):printf("+%d\n",result[i][j]);
}
}