Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
1
Indexable
Never
#include<iostream>
using namespace std;

char a[9][9];

int main(){
 //freopen("input.txt", "r", stdin);
	
	int T;
	cin >> T;
	for(int tc = 1; tc <= T; tc++){
		
		for( int i = 0; i <9; i++){
			for( int j = 0; j < 9; j++){
				cin >> a[i][j];
			}
		}
		bool check =true;
	for( int i = 0; i <9; i++){
		if(check == false) break;
			for( int j = 0; j < 9; j++){
				if(check == false) break;
					if(a[i][j]!='.'){
					for(int k = j+1; k<9; k++){
						if(a[i][k] == a[i][j]){
							check =false;
							break;
						}
					}
					}
			}
	}
	for( int i = 0; i <9; i++){
		if(check == false) break;
			for( int j = 0; j < 9; j++){
				if(check == false) break;
					if(a[j][i]!='.'){
					for(int k = j+1; k<9; k++){
						if(a[k][i] == a[j][i]){
							check =false;
							break;
						}
					}
					}
			}
	}

	for( int i = 0; i <9; i+3){
		if(check == false) break;
		for( int j = 0; j < 9; j+3){
			if(check == false) break;
				if(a[i][j]!='.'){
					int u =a[i][j];
					for(int k = j; k<2; k++){
						if(a[i][k] == a[i][k+1]){
							check =false;
							break;
						}
					}
					}
			}
	}

	

	if(check) cout << "#" << tc <<" " << 1 << endl;
	if(!check) cout << "#" << tc <<" " << 0 << endl;

	}
 return 0;
}