pku ACM 高手快进来呀 ,我有一个问题 请高手帮忙, 求求各位了 没分了??
我做的是PKU ACM 1548 http://acm.pku.edu.cn/JudgeOnline/problem?id=1548
麻烦那为高手看看我错在了什么地方。或是给点数据也可以呀?? 谢谢了。
#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 lenth;
int weight;
int s,t;
int k = 0;
while( cin >>s >> t && s != -1 && t != -1)
{
if( s != 0 && t != 0)
{
num[k].lon = s;
num[k].wth = t;
num[k].sum = s + t;
num[k].a = 1;
k++;
}
if( s == 0 && t == 0)
{
int count = 0;
sort( num , num + k , op);
sort( num , num + k , oop);
int j,l;
for( j = 0 ; j < k ; j++)
{
if( num[j].a != 0)
{
count++;
lenth = num[j].lon;
weight = num[j].wth;
cout << "lenth"<< lenth << " "<<"weight"<< weight << endl;
for( l = j + 1 ; l < k ; l++)
{
if( num[l].a != 0)
{
if( num[l].lon >= lenth )
{
if( num[l].wth >= weight)
{
num[l].a = 0;
lenth = num[l].lon;
weight = num[l].wth;
cout << "lenth"<< lenth << " "<<"weight"<< weight << endl;
}
}
}
}
}
}
cout << count <<endl;
int rt ;
for( rt = 0 ; rt < k ; rt ++)
{
num[rt].a = 0;
num[rt].lon = 0;
num[rt].wth = 0;
}
k = 0;
}
}
system("pause");
return 0;
}
所有的数据都测试了就是不知道还有什么情况没有考虑到,那为大哥帮帮忙哦,小弟感激不尽哦!!