2024-08-23 15:14:35 +00:00
|
|
|
//NOT DONE
|
2024-08-23 14:19:02 +00:00
|
|
|
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
2024-08-23 15:14:35 +00:00
|
|
|
#ifdef OI
|
|
|
|
#define DB(code){code}
|
|
|
|
#else
|
|
|
|
#define DB(code)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int m[10][10];
|
|
|
|
// bool check_h[10][10],check_l[10][10],check_yx[20][10],check_zx[20][10];
|
|
|
|
// bool check_all(int x,int y,int num){
|
|
|
|
// if(check_h[x][num]){
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// if(check_l[y][num]){
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// if(check_yx[x-y+8][num]){
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// if(check_zx[])
|
|
|
|
// }
|
|
|
|
|
|
|
|
// bool check(int x,int y,int num);
|
|
|
|
bool check(int x,int y,int num);
|
|
|
|
void dfs(int x,int y){
|
|
|
|
if(x==9&&y==9){
|
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
for(int j=1;j<=9;j++){
|
|
|
|
cout<<m[i][j];
|
|
|
|
}
|
|
|
|
cout<<endl;
|
|
|
|
}
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2024-08-23 14:19:02 +00:00
|
|
|
|
|
|
|
int main(){
|
2024-08-23 15:14:35 +00:00
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
char ch[15];
|
|
|
|
cin.getline(ch,10);
|
|
|
|
for(int j=1;j<=9;j++){
|
|
|
|
if(ch[j-1]=='.'){
|
|
|
|
m[i][j]=-1;
|
|
|
|
}else{
|
|
|
|
m[i][j]=ch[j-1]-'0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DB(
|
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
for(int j=1;j<=9;j++){
|
|
|
|
cout<<m[i][j]<<" ";
|
|
|
|
}
|
|
|
|
cout<<endl;
|
|
|
|
}
|
|
|
|
)
|
2024-08-23 14:19:02 +00:00
|
|
|
|
2024-08-23 15:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// void dfs(int x,int y){
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
bool check(int x,int y,int num){
|
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
if(m[i][y]==num){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(int i=1;i<=9;i++){
|
|
|
|
if(m[x][i]==num){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(int i=x+1,j=y+1;i<=9&&j<=9;i++,j++){
|
|
|
|
if(m[i][j]==num){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(int i=x-1,j=y-1;i>=1&&j>=1;i--,j--){
|
|
|
|
if(m[i][j]==num){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
17.5..8..
|
|
|
|
.52.1....
|
|
|
|
.....759.
|
|
|
|
.8...94.3
|
|
|
|
.197.4..8
|
|
|
|
7......15
|
|
|
|
4.1...6..
|
|
|
|
3...2..59
|
|
|
|
...96..3.
|
|
|
|
*/
|