Polaris_blig @ 2019-02-12 15:05:52
很好奇为什么下载的测试点自己测试是对的,洛谷测试wa了呢? 代码如下:
using namespace std;
bool compare( vector<int> x,vector<int> y) {
return x[1] < y[1];
} int main() {
int n, s, a, b;
int count = 0;
vector<vector<int> > xy ;
cin >> n >> s >> a >> b;
for (int i = 0;i < n;i++) {
int xi, yi;
cin >> xi >> yi;
xy.push_back({ xi,yi });
}
sort(xy.begin(), xy.end(), compare);
for (int j = 0;j < n;j++) {
if (s > 0) {
if ((a + b) >= xy[j][0] && (s - xy[j][1] >= 0)) {
count++;
s -= xy[j][1];
}
else if (s - xy[j][1] < 0)
break;
}
}
cout << count;
}
by t162 @ 2019-02-12 15:07:21
请不要用一级标题来体现头文件的重要性。
by SPARTAN_117 @ 2019-02-12 15:10:24
火钳留名
by PrincessQi @ 2019-02-12 15:11:07
@Bambusoideae 人家大佬没打
这个=>```
by superMB @ 2019-02-12 15:12:35
@Dr冯 别人开玩笑的23333,认真你就输了
by PrincessQi @ 2019-02-12 15:22:26
@superMB 233
by Polaris_blig @ 2019-02-12 15:56:35
@Bambusoideae 新手不太会用……
by Polaris_blig @ 2019-02-12 16:12:37
请各位dalao帮忙看一下
include<iostream>
include<iomanip>
include<math.h>
include<cstring>
include<string>
include<fstream>
include<sstream>
include<algorithm>
include<vector>
using namespace std;
bool compare( vector<int> x,vector<int> y) {
return x[1] < y[1];
} int main() {
int n, s, a, b;
int count = 0;
vector<vector<int> > xy ;
cin >> n >> s >> a >> b;
for (int i = 0;i < n;i++) {
int xi, yi;
cin >> xi >> yi;
xy.push_back({ xi,yi });
}
sort(xy.begin(), xy.end(), compare);
for (int j = 0;j < n;j++) {
if (s > 0) {
if ((a + b) >= xy[j][0] && (s - xy[j][1] >= 0)) {
count++;
s -= xy[j][1];
}
else if (s - xy[j][1] < 0)
break;
}
}
cout << count;
return 0;
}
by wangqz @ 2021-06-28 15:19:35
测试点是什么啊
by huangxingzhi02 @ 2021-08-17 10:28:52
你的#呢