题解
2025-08-05 13:56:57
发布于:上海
3阅读
0回复
0点赞
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 1e3;
ll n, m, c;
ll a[N][N];
int main(){
cin >> n >> m >> c;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
ll temp;
cin >> temp;
a[i][j] = a[i-1][j] + a[i][j-1] - a[i-1][j-1] + temp;
}
}
ll mx = 0;
ll x = 0;
ll y = 0;
for(int i=0; i+c<n; i++){
for(int j=0; j+c<m; j++){
ll num = a[i+c][j+c] - a[i][j+c] - a[i+c][j] + a[i][j];
if(mx < num){
mx = num;
x = i + 1;
y = j + 1;
}
}
}
cout << x << " " << y << endl;
return 0;
}
这里空空如也
有帮助,赞一个