验证中...
本周日,苏州开源盛宴,一起聊聊:Devops、K8s、数据库建模、SoLiD、.Net Core、微信开发、去中心化… 点击占座。
语言: C/C++
分类: 算法分析
最后更新于 2019-03-15 20:53
gistfile1.txt
原始数据 复制代码
#include <stdio.h>
#include <string.h>
#include <memory.h>
typedef struct
{
char left[5];
char right[5];
char state[5];
} Info;
int main()
{
int n;
Info info[3];
char judge[2]['L' - 'A' + 1];
for (char c = 'A'; c <= 'L'; c++)
{
judge[0][c - 'A'] = c;
}
scanf("%d", &n);
while (n--)
{
memset(judge[1], 0, sizeof (judge[1]));
for (int i = 0; i < 3; ++i)
{
scanf("%s %s %s", info[i].left, info[i].right, info[i].state);
if (!strcmp("even", info[i].state))
{
for (int j = 0; j < 4; ++j)
{
judge[1][info[i].left[j] - 'A'] = 1;
judge[1][info[i].right[j] - 'A'] = 1;
}
}
else if (!strcmp("up", info[i].state))
{
for (int j = 0; j < 4; ++j)
judge[1][info[i].left[j] - 'A'] = 1;
}
else if (!strcmp("down", info[i].state))
{
for (int j = 0; j < 4; ++j)
judge[1][info[i].right[j] - 'A'] = 1;
}
}
for (int i = 0; i < ('L' - 'A'); ++i)
{
if (judge[1][i] == 0)
printf("%c is the counterfeit coin and it is light.\n", judge[0][i]);
}
}
return 0;
}

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助

14_float_left_people 14_float_left_close