分析:%一发腾爷的做法,强的不行。
http://www.cnblogs.com/Enceladus/p/5037420.html
#include<cstdio>
#include<algorithm>
using namespace std;
int n,h[200][202],l[200][202],g[200][202],f[200][202],m,i,j;
int main(){
scanf("%d",&n);
for (i=0;i<n;i++)
for (j=0;j<n;j++){
scanf("%d",&m);
h[i][j]=h[i][j-1]+m;
l[j][i]=l[j][i-1]+m;
g[(i-j+2*n)%n][i]=g[(i-j+2*n)%n][i-1]+m;
f[(i+j)%n][i]=f[(i+j)%n][i-1]+m;
}
for (i=0;i<n;i++)
for (j=0;j<n;j++){
if (m<h[i][j]-h[i][n]) m=h[i][j]-h[i][n];
if (m<l[i][j]-l[i][n]) m=l[i][j]-l[i][n];
if (m<g[i][j]-g[i][n]) m=g[i][j]-g[i][n];
if (m<f[i][j]-f[i][n]) m=f[i][j]-f[i][n];
if (m<h[i][n-1]-(h[i][j-1]-h[i][n+1])) m=h[i][n-1]-(h[i][j-1]-h[i][n+1]);
if (m<l[i][n-1]-(l[i][j-1]-l[i][n+1])) m=l[i][n-1]-(l[i][j-1]-l[i][n+1]);
if (m<g[i][n-1]-(g[i][j-1]-g[i][n+1])) m=g[i][n-1]-(g[i][j-1]-g[i][n+1]);
if (m<f[i][n-1]-(f[i][j-1]-f[i][n+1])) m=f[i][n-1]-(f[i][j-1]-f[i][n+1]);
if (h[i][n]>h[i][j]) h[i][n]=h[i][j];
if (l[i][n]>l[i][j]) l[i][n]=l[i][j];
if (g[i][n]>g[i][j]) g[i][n]=g[i][j];
if (f[i][n]>f[i][j]) f[i][n]=f[i][j];
if (h[i][n+1]<h[i][j]) h[i][n+1]=h[i][j];
if (l[i][n+1]<l[i][j]) l[i][n+1]=l[i][j];
if (g[i][n+1]<g[i][j]) g[i][n+1]=g[i][j];
if (f[i][n+1]<f[i][j]) f[i][n+1]=f[i][j];
}
printf("%d\n",m);
}