题解
2024-04-27 13:00:53
发布于:广东
11阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
#include <memory.h>
using namespace std;
bool mp[105][105], vis[105][105];
int ct, n, m;
bool check(int x, int y){
int cct = 0;
for(int i = 1; i <= m; i++){
if(!vis[i][y]){
vis[i][y] = 1;
if(mp[i][y]) cct++;
}
}for(int i = 1; i <= n; i++){
if(!vis[x][i]){
vis[x][i] = 1;
if(mp[x][i]) cct++;
}
}return cct == ct;
}
int main(){
char x;
cin >> n >> m;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> x;
if(x == '*'){
ct++;
mp[i][j] = 1;
}
}
}for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
memset(vis, 0, sizeof(vis));
if(check(i, j)){
cout << "YES\n" << i << ' ' << j;
return 0;
}
}
}cout << "NO";
return 0;
}
时间复杂度:
这里空空如也
有帮助,赞一个