Pagini recente » Cod sursa (job #2195493) | Cod sursa (job #358062) | Borderou de evaluare (job #851954) | Cod sursa (job #2985117) | Cod sursa (job #109542)
Cod sursa(job #109542)
#include<iostream.h>
#include<fstream.h>
ifstream f("teren.in");
ofstream g("teren.out");
int main()
{
int n,m,i,o,j,l,x,y,c=1,s,p;
long int x1,teren[100][100];
f>>n>>m>>x1;
for(p=1;p<=n%2+1;p++)
{
for (i=p;i<=n;i++)
{
for (j=1;j<=m;j++)
{f>>teren[i][j];}
}
for(l=n;l>=1;l--)
{ for(o=m;o>=1;o--)
{
s=0;
for(y=1;y<=l;y++)
for(x=1;x<=o;x++)
{
if (teren[x][y]==1) s++;
if (s>x1) break;
}
if (s==x1&&y==4&&x==4) {c=0;g<<l*o;break;}
}
if(c==0) break;}
if(c==0) break;
}
f.close();
g.close();
return 0;
}