| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求助大牛以下错在哪#include <iostream>
#include <memory>
using namespace std;
bool ins1[100][10];
bool ins2[100][10];
bool temp[100][10];
int main()
{
int i,j,k,res,num,width,height,row1,row2,tmp,t;
char ch;
while(cin>>num>>width>>height)
{
if(!(num+width+height))
break;
for(k=0;k<num;++k)
{
if(!k)
{
cin>>row1;
for(i=0;i<row1;++i)
for(j=0;j<width;++j)
{
cin>>ch;
if(ch=='X')
ins1[i][j]=1;
else
ins1[i][j]=0;
}
res=row1;
}
else
{
cin>>row2;
for(i=0;i<row2;++i)
for(j=0;j<width;++j)
{
cin>>ch;
if(ch=='X')
ins2[i][j]=1;
else
ins2[i][j]=0;
}
bool flag=true;
tmp=0;
for(i=row2-1;i>=0;--i)
{
if(flag)
{
++tmp;
if(tmp<=row1)
{
for(t=0;t<tmp && flag;++t)
for(j=0;j<width && flag;++j)
if(!((ins1[tmp-1-t][j] && !ins2[row2-1-t][j]) || !ins1[tmp-1-t][j]))
flag=false;
}
}
}
if(res+row2+1-tmp>=height)
{
cout<<res<<" ";
res=0;
if(k==num-1)
cout<<row2<<endl;
}
else
{
res += (row2 + 1 - tmp);
if(k==num-1)
{
cout<<res<<endl;
res=0;
}
for(t=0;t<row2+1-tmp;++t)
for(j=0;j<width;++j)
temp[t][j]=ins2[t][j];
for(i=0;i<tmp;++i)
{
for(j=0;j<width;++j)
temp[t][j]=ins1[i][j]|ins2[t][j];
++t;
}
for(i=tmp;i<row1;++i)
{
for(j=0;j<width;++j)
temp[t][j]=ins1[i][j];
++t;
}
row1=res;
for(i=0;i<row1;++i)
for(j=0;j<width;++j)
ins1[i][j]=temp[i][j];
}
}
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator