比赛 |
20150714B |
评测结果 |
TWWWWAWAAW |
题目名称 |
拱猪计分 |
最终得分 |
30 |
用户昵称 |
胡嘉兴 |
运行时间 |
1.003 s |
代码语言 |
C |
内存使用 |
0.29 MiB |
提交时间 |
2015-07-14 10:05:02 |
显示代码纯文本
#include<stdio.h>
#include<math.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int s[15], n, flag = 0, i, j, flagC = 1, x = 0, flag2 = 0;
char s2[5];
int book[13] = {-50, -2, -3, -4, -5, -6, -7, -8, -9, -10, -20, -30, -40};
freopen("heart.in", "r", stdin);
freopen("heart.out", "w", stdout);
while(1)
{
for(i = 0; i < 4; i++)
{
scanf("%d", &n);
if(n == 0&&flag == 0&&i != 0)
{
printf("0 ");
continue;
}
if(n == 0)
{
flag++;
continue;
}
if(n != 0&&flag > 0)
{
for(j = 0; j < flag; j++)
{
printf("0 ");
}
}
if(n == 16)
{
printf("+1000 0 0 0");
for( ; i < 4; i++)
{
for(j = 0; j < n; j++)
{
scanf("%s", s2);
}
}
break;
}
if(n == 15)
{
for(j = 0; j < n; j++)
{
scanf("%s", s2);
}
printf("+500 ");
continue;
}
if(n == 13)
{
for(j = 0; j < n; j++)
{
scanf("%s", s2);
}
printf("+200 ");
continue;
}
for(j = 0; j < n; j++)
{
scanf("%s", s2);
if(strcmp(s2, "S12") == 0)
{
x -= 100;
}
else if(strcmp(s2, "D11") == 0)
{
x += 100;
}
else if(strcmp(s2, "C10") == 0)
{
if(n == 1)
{
printf("50 ");
continue;
}
else
{
flagC = 2;
}
}
else if(s2[0] == 'H')
{
if(strstr(s2, "H10") != NULL)
{
x += book[9];
}
else if(strstr(s2, "H11") != NULL)
{
x += book[10];
}
else if(strstr(s2, "H12") != NULL)
{
x += book[11];
}
else if(strstr(s2, "H13") != NULL)
{
x += book[12];
}
else
{
x += book[s2[1] - '0' - 1];
}
}
}
if(x > 0)
{
printf("+%d ", x * flagC);
}
else
{
printf("%d ", x * flagC);
}
flagC = 1;
x = 0;
}
printf("\n");
if(flag == 4)
{
break;
}
flag = 0;
}
fclose(stdin);
fclose(stdout);
return 0;
}