【题解】P8144 [JRKSJ R4] BBWWBB

思路

分析题意可得,白方必定不会胜利,只能尽量让游戏无限进行下去。那么我们只考虑黑方能否胜利。

若想让戏能无限进行下去,必须满足以下条件。

  1. 白方先手。
  • 若黑方先手必然可以吃掉一个白方,白方仅有一个棋子,必输。
  1. 白方第一轮可以吃掉一颗黑方。
  • 因为只有 \(3,4\) 是白方,所以只要判断 \(a_{3}=1+a_{2}\)\(a_{4}+1=a_{5}\) 即可。
  1. 白方吃完黑方后,不能被黑方吃掉另一个。

AC Code

#include<bits/stdc++.h>
using namespace std;
char c;
int a[7],t;
bool h[1000000000];
int main() {
	cin>>t;
	while(t--) {
		cin>>c;
		for(int i=1; i<=6; i++) {
			cin>>a[i];
		}
		if(c=='B') {
			cout<<"No\n";
			continue;
		}
		if((a[2]+1==a[3] && a[1]+1!=a[2]) != (a[4]+1==a[5] && a[5]+1!=a[6])) {
			cout<<"Yes\n";
		} else {
			cout<<"No\n";
		}
	}
	return 0;
}
posted @ 2024-07-10 17:16  Kcjhfqr  阅读(94)  评论(0)    收藏  举报
.poem-wrap { position: relative; width: 1000px; max-width: 80%; border: 2px solid #797979; border-top: none; text-align: center; margin: 40px auto; } .poem-left { left: 0; } .poem-right { right: 0; } .poem-border { position: absolute; height: 2px; width: 27%; background-color: #797979; } .poem-wrap p { width: 70%; margin: auto; line-height: 30px; color: #797979; } .poem-wrap h1 { position: relative; margin-top: -20px; display: inline-block; letter-spacing: 4px; color: #797979; font-size: 2em; margin-bottom: 20px; } #poem_sentence { font-size: 25px; } #poem_info { font-size: 15px; margin: 15px auto; }