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 |
Re:5555555555555为什么一直都是WA 那为高手帮帮忙看看,或给几组数据也行,高手帮帮忙呀!!~~~~~~~~~~~~~~In Reply To:5555555555555为什么一直都是WA 那为高手帮帮忙看看,或给几组数据也行,高手帮帮忙呀!!~~~~~~~~~~~~~~ Posted by:fanxicai2001 at 2007-09-14 12:30:12 > #include<iostream> > #include<algorithm> > using namespace std; > struct fan > { > int a; > int lon; > int wth; > int sum; > }num[6000]; > bool op( struct fan x , struct fan y) > { > return x.sum > y.sum; > }; > bool oop(struct fan xx, struct fan yy) > { > return xx.lon > yy.lon; > }; > int main() > { > int rt; > int lenth; > int weight; > cin >> rt; > while(rt--) > { > int b,k,i=0; > int count = 0; > cin >> b; > for( k = 0 ; k <b ; k++) > { > cin >> num[i].lon >> num[i].wth; > num[i].a = 1; > num[i].sum = num[i].lon + num[i].wth; > i++; > } > sort( num , num + b , op); > sort( num , num + b , oop); > int j,l; > for( j = 0 ; j < b ; j++) > { > if( num[j].a != 0) > { > count++; > lenth = num[j].lon; > weight = num[j].wth; > for( l = j + 1 ; l < b ; l++) > { > if( num[l].a != 0) > { > > if( num[l].lon <= lenth ) > { > if( num[l].wth <= weight) > { > num[l].a = 0; > } > } > } > } > } > } > int rt = b; > for( rt = 0 ; rt < b ; rt ++) > { > num[rt].a = 0; > num[rt].lon = 0; > num[rt].wth = 0; > } > cout << count <<endl; > } > 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