第一个测试点过不去,哪位dl能提供一下第一个测试点的信息?

P1478 陶陶摘苹果(升级版)

最好不要用c++内部定义过的函数名
by qrhao @ 2020-02-11 17:04:49


@[zhs3202669494](/user/303464)
by qrhao @ 2020-02-11 17:10:09


```cpp #include <cstdio> #include <iostream> #include <cmath> #include <algorithm> #include <string> #include <cstring> #include <stack> #include <queue> #include <map> #include <vector> #include <list> #include <set> #include <functional> #include <fstream> #include <iomanip> #include <cstdlib> #include <cctype> #include <ctime> #include <sstream> using namespace std; struct h{ int g; int l; }shu[5005]; bool cmp(h a,h b) { return a.l < b.l; } int main() { int n,s,a,b,sum = 0; scanf("%d %d",&n,&s); scanf("%d %d",&a,&b); for(int i = 1;i <= n;i++) { scanf("%d %d",&shu[i].g ,&shu[i].l); } sort(shu + 1,shu + n + 1,cmp); for(int i = 1;i <= n;i++) { if(s - shu[i].l < 0) { break; } if((a + b) < shu[i].g) continue; sum++; s -= shu[i].l; } printf("%d",sum); return 0; } ```
by qrhao @ 2020-02-11 17:23:56


C++有内部函数sort,count和swap
by Clintikas97 @ 2020-02-11 17:27:00


@[qiruhao](/user/205892) 我这个是C 语言
by zhs3202669494 @ 2020-02-11 17:31:25


@[qiruhao](/user/205892) 好的,明白你的意思了
by zhs3202669494 @ 2020-02-11 17:35:38


你语言识别是c语言吗
by qrhao @ 2020-02-11 17:39:09


@[zhs3202669494](/user/303464)
by qrhao @ 2020-02-11 17:39:21


@[qiruhao](/user/205892) 是的
by zhs3202669494 @ 2020-02-11 17:41:44


第一个测试点 7 6 3140 0 110 1 100 3 127 1 121 1 0 99 130 0 90 6 答案应该是5 他给的.out里写了个4,是不对的,并且4过不了
by Snnnow @ 2020-03-06 22:28:23


|