某个蒟蒻,改不明白了,有没有大佬看看是哪亿点问题
查看原帖
某个蒟蒻,改不明白了,有没有大佬看看是哪亿点问题
247159
林楚颜楼主2021/8/10 18:31
#include<bits/stdc++.h>
using namespace std;
int qp[3][3],tk;
char xx;
bool sb=0;
bool jg()
{
	if((xx-'0'==3||xx-'0'==5||xx-'0'==7)&&(qp[0][2]==qp[1][1]&&qp[1][1]==qp[2][0]&&qp[0][2]!=0)) return 1;
	if((xx-'0'==1||xx-'0'==5||xx-'0'==9)&&(qp[0][0]==qp[1][1]&&qp[1][1]==qp[2][2]&&qp[0][0]!=0)) return 1; 
	if(qp[(xx-'0'-1)/3][0]==qp[(xx-'0'-1)/3][1]&&qp[(xx-'0'-1)/3][1]==qp[(xx-'0'-1)/3][2]&&qp[(xx-'0'-1)/3][0]!=0) return 1;
	if(qp[0][(xx-'0'-1)%3]==qp[1][(xx-'0'-1)%3]&&qp[1][(xx-'0'-1)%3]==qp[2][(xx-'0'-1)%3]&&qp[0][(xx-'0'-1)%3]!=0) return 1;
	return 0;
	
}
int main()
{
	while(cin>>xx)
	{
		qp[(xx-'0'-1)/3][(xx-'0'-1)%3]=sb+1;
		if(tk==0&&jg()==1)
		{
			tk=1;
			if(sb==0) cout<<"xiaoa wins.";
			else cout<<"uim wins.";
		}
		sb=!sb;
	}
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			cout<<qp[i][j];
		}
		cout<<endl;
	} 
	if(tk==0) cout<<"drew.";
	return 0;
}

码风一般~~(见谅)~~

2021/8/10 18:31
加载中...