2020牛客国庆集训派对day2 H-STROOP EFFECT(英语题)

2020牛客国庆集训派对day2 H-STROOP EFFECT(英语题)

题目

https://ac.nowcoder.com/acm/contest/7818/H

题意

这题目真的太难读懂了,赛后我也是看了别人的代码才看懂题目的…
要求是:
对角线的和与非对角线的和相等
非对角线的组合必须关于对角线对称
连续三个的颜色或字不能相同
对角线内部要相等

题解

直接模拟就好

代码

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t, cas = 1;
	scanf("%d", &t);
	int cnt[5][5], cnt2[5][5], cnt3[5];
	while(t--)
	{
		int a, b, ok = 1, temp2 = -1,temp3 = -1;
		memset(cnt2, 0, sizeof(cnt2));
		memset(cnt3, 0, sizeof(cnt3));
		while(1)
		{
			int temp;
			scanf("%d", &temp);
			a = temp/10;
			b = temp%10;
			if(temp2 != -1&&temp3 !=-1)
			{
				if(temp2/10 == temp/10&&temp2/10 ==temp3/10)
				{
					ok = 0;
				}
				else if(temp2%10 == temp%10&&temp2%10 ==temp3%10)
				{
					ok = 0;
				}
			}
			if(a == 0 && b == 0)
			{
				break;
			}
			cnt3[a]++;
			cnt3[b]++;
			cnt2[a][b]++;
			if(temp2!=-1)	temp3 = temp2;
			temp2 = temp;
		}
		if(!(cnt2[1][1]==cnt2[2][2]&&cnt2[1][1]==cnt2[3][3]&&cnt2[1][1]==cnt2[4][4]))
			ok = 0;
		for(int i=1;i<5;i++)
			for(int j=i+1;j<5;j++)
				if(cnt2[i][j]!=cnt2[j][i])
					ok = 0;
		
		if(ok) printf("Case #%d: Stroop\n", cas++);
		else printf("Case #%d: Not Stroop\n", cas++);
	}
}
/*
12
11 12 13 21 22 23 31 32 33 11 22 33 00
42 14 34 11 11 11 13 33 41 23 22 21 22 31 44 32 33 12 44 22 44 43 24 33 00
*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值