求错,在线等

P1478 陶陶摘苹果(升级版)

@[fzhfzh](/space/show?uid=158050) 先把码风该漂亮了再说
by 御·Dragon @ 2019-05-13 19:04:50


在读入高度和力气的情况下, 必须要判断可以摘到啊
by DARKSTALKING @ 2019-05-13 19:05:36


@[封禁用户名f8617dda](/space/show?uid=37682) 什么意思
by fzhfzh @ 2019-05-13 19:05:45


这码风有什么奇怪的吗
by DARKSTALKING @ 2019-05-13 19:06:28


@[DARKSTALKING](/space/show?uid=121589) 写地下了
by fzhfzh @ 2019-05-13 19:06:29


@[fzhfzh](/space/show?uid=158050) 意思就是写代码的格式啦
by DARKSTALKING @ 2019-05-13 19:06:48


测试点四: 输入:0 0 0 0 输出:0 我用我的代码测试后输出的也是0呀?
by fzhfzh @ 2019-05-13 19:07:38


@[DARKSTALKING](/space/show?uid=121589)
by fzhfzh @ 2019-05-13 19:07:50


```cpp #include<bits/stdc++.h> using namespace std; int n,power,a,b,sum,num[5005],ans; int main() { cin>>n>>power>>a>>b; int f=0; for(int i=0;i<n;i+=1) { int high,need; cin>>high>>need; if(high<=a+b) { num[f]=need; f+=1; } } sort(num,num+f); for(int i=0;i<n;i+=1) { if(num[i]+sum>power) break; if(num[i]+sum<=power) { ans+=1; sum+=num[i]; } } cout<<ans<<endl; return 0; } ```
by DARKSTALKING @ 2019-05-13 19:08:14


@[fzhfzh](/space/show?uid=158050) 不知道,我有时也有这样的问题
by DARKSTALKING @ 2019-05-13 19:09:14


| 下一页