| ||||||||||
| 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 | |||||||||
不是跟1065一样吗,为啥我的用C++是WA,用G++是RE,诡异,哪位大牛指导下#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 600
bool vist[N];
struct node
{
int l,w;
}a[N];
bool cmp(const node &x,const node &y)
{return x.l<=y.l||((x.l==y.l)&&(x.w>=y.w));}
int main()
{
int ta,tb,num=0;
node t;
while(scanf("%d%d",&ta,&tb),ta!=-1||tb!=-1){
if(ta==0&&tb==0){
sort(a,a+num,cmp);
int k=0,i,j;
for(i=0;i<num;++i)
if(!vist[i]){
t=a[i];
vist[i]=1;
for(j=i+1;j<num;++j) if(!vist[j]&&t.w<=a[j].w&&t.l<=a[j].l) {t=a[j];vist[j]=1;}
++k;
}
cout<<k<<endl;
//cout<<num<<endl;
num=0;
}
else {a[num].l=ta;a[num].w=tb;vist[num]=0;++num;}
}
//system("PAUSE");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator