CP005876.攻打猫星
2023-08-03 10:45:34
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
int n;
int g[110][110],val[110][110],maxx;
int main(){
cin >> n;
for(int i = 0;i <= n;i++)
g[0][i] = g[i][0] = g[n+1][i] = g[i][n+1] = 1;
for(int i = 1;i <= n;i++)
for(int j = 1;j <= n;j++)
cin >> g[i][j];
for(int i = 1;i <= n;i++){
for(int j = 1;j <= n;j++){
int cnt = g[i][j];
cnt *= g[i-1][j-1]*g[i-1][j+1]*g[i-1][j]*g[i][j-1];
cnt *= g[i][j+1]*g[i+1][j-1]*g[i+1][j]*g[i+1][j+1];
val[i][j] = cnt;
maxx = max(maxx,cnt);
}
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= n;j++){
if(val[i][j] == maxx){
cout << i << " " << j << endl;
}
}
}
return 0;
}
这里空空如也
有帮助,赞一个