题意:刷墙,两把刷子,只能沿对角线刷,并且一次必须刷完一条线。红色刷子沿'\' 方向,蓝色刷子沿'/'方向,都刷到的格子为绿色。给出最终状态,求最少需要刷多少次可以达到。
思路:对于'\',如果当前格子为红色或者绿色,前一个格子(斜线上的)既不是红色也不是绿色,则必然要刷一次。同理,'/'上的也是。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<cmath>
#define ll __int64
using namespace std;
const int INF=0x3fffffff;
char s[55][55];
int main()
{
//freopen("d:\\Test.txt","r",stdin);
int T,n;
cin>>T;
while(T--){
cin>>n;
for(int i=1;i<=n;i