做题WA了,写代码时考虑的不周全,没有考虑到当木棒长度相等时,还需要按重量对此排序。
然后看了网友博客里写的代码,感觉自己写的代码相比别人的来说很乱,。
#include<stdio.h>
#define LOCAL
struct wooden
{
int length, weight;
}s[5005], buf[5005], tmp, pre;
int main()
{
#ifdef LOCAL
freopen("Wooden.in.txt", "r", stdin);
#endif
int t, n, i, j, k, m, count;
scanf("%d", &t);
while(t-- && scanf("%d", &n) && n>=1 && n<= 5000)
......
阅读全文