Pagini recente » Cod sursa (job #3273564) | Cod sursa (job #1511525) | Cod sursa (job #974700) | Cod sursa (job #1726137) | Cod sursa (job #2487206)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("teren.in");
ofstream fout("teren.out");
int n,i,j,m,l,k,c,s[310][310],x,lin1,lin2,dr,st,maxi;
int main()
{
fin>>n>>m>>c;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
fin>>x,s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+x;
for(lin1=1;lin1<=n;lin1++)
for(lin2=lin1;lin2<=n;lin2++)
{
dr=m;
st=m;
while(st>1)
{
while(s[lin2][dr]-s[lin2][st-1]-s[lin1-1][dr]+s[lin1-1][st-1]<=c && st>1)
st--;
maxi=max(maxi,(lin2-lin1+1)*(dr-st+1));
dr--;
}
}
fout<<maxi;
return 0;
}