| ||||||||||
| 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 | |||||||||
why wa?#include<iostream>
using namespace std;
int main()
{
bool map[30][30];
int r,c;
while(1)
{
scanf("%d%d",&r,&c);
if(r==-1&&c==-1)
break;
if(!r&&!c)
{
cout<<0<<endl;
continue;
}
memset(map,0,sizeof(map));
int g=0;
map[r][c]=1;
g++;
while(1)
{
if(!r&&!c)
break;
scanf("%d%d",&r,&c);
if(!r&&!c)
break;
map[r][c]=1;
g++;
}
int ans=0;
int right=0;
while(g)
{
ans++;
int rr=0;
for(right=24;!map[rr][right]&&right>0;right--);
for(int c=0;c<30;c++)
{
if(map[rr][c]==1)
{
g--;
map[rr][c]=0;
}
while(c>=right)
{
if(rr==25)
break;
if(c==right)
{
g--;
map[rr][c]=0;
}
rr++;
for(right=29;!map[rr][right]&&right>0;right--);
}
if(map[rr][c]==1)
{
g--;
map[rr][c]=0;
}
}
}
printf("%d\n",ans);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator