题目:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn=0x3f3f3f3f;
int a[1007][1007],s[1007][1007];
int main()
{
int n,m,c;
scanf("%d %d %d",&n,&m,&c);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
scanf("%d",&a[i][j]);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i==1&&j==1)
s[i][j]=1;
else
s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a[i][j];
}
}
int ans=-maxn;
//+=c-1;
int posx=c,posy=c;
for(int i=c;i<=n;i++)
{
for(int j=c;j<=m;j++)
{
if(s[i][j]-s[i-c][j]-s[i][j-c]+s[i-c][j-c]>ans)
{
ans=s[i][j]-s[i-c][j]-s[i][j-c]+s[i-c][j-c];
posx=i-c+1;
posy=j-c+1;
}
}
}
printf("%d %d\n",posx,posy);
}