constint maxn=55,maxk=2505; int n,m,K,N,s[maxn][maxn],f[maxn][maxk],g[maxn][maxk]; char a[maxn][maxn]; #define w(i,l,r) (max(s[i][r]-s[i][(l)-1],(r)-(l)+1-s[i][r]+s[i][(l)-1])) #define up(x,y) (x=max(x,y)) intmain(){ scanf("%d%d%d",&n,&m,&K); for (int i=1;i<=n;i++) scanf("%s",a[i]+1); for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) s[i][j]=s[i][j-1]+a[i][j]-'0'; for (int x=1;x<=n;x++){ cl(f,192); f[0][0]=0; for (int i=1;i<=m;i++) for (int j=1;j<=i&&j<=K;j++){ f[i][j]=f[i-1][j]; for (int k=0;k<i;k++) up(f[i][j],f[k][j-1]+w(x,k+1,i)); } for (int i=1;i<=m;i++) for (int j=i;j<=K;j++) up(g[x][j],g[x-1][j-i]+f[m][i]); } int ans=0; for (int i=1;i<=K;i++) ans=max(ans,g[n][i]); printf("%d",ans); return0; }