题目思路
将兔子的血量从大到小排列,将箭的属性写在类中(结构体也成),排序按照伤害从大到小排列,若有相等的则按价格从小到大排。
代码
#include<bits/stdc++.h>
using namespace std;
int N, M;
const int maxn = 100000+10;
int b[maxn], d[maxn], p[maxn];
class Arrow
{
public:
int D, P;
Arrow(int i, int j):D(i), P(j){
}
Arrow(){
}
}a[maxn];
bool cmp(Arrow s1, Arrow s2)