acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 竞赛
  • 讨论
  • 团队
登录
注册
题目详情提交记录(0)
  • 秒了

    userId_undefined

    杨熙铭

    时空双修者空间掌握者时间刺客出道萌新字符串·魔法使贪心·贪心尝试者
    72阅读
    1回复
    0点赞
  • 题解

    #include<bits/stdc++.h> using namespace std; struct Apple{ int height,qe; }; bool rt(const Apple& a, const Apple& b) { return a.qe<b.qe; } int mx(int n,int s,int a,int b,vector<Apple>& apples) { sort(apples.begin(), apples.end(), rt); int count=0; for(const auto& apple : apples) { if(s>=apple.qe) { if (apple.height<=b || (apple.height-a)<=b) { s-=apple.qe; count++; } } else{ break; } } return count; } int main() { int n, s, a, b; cin>>n>>s>>a>>b; vector<Apple>apples(n); for (int i=0;i<n;i++) { cin>>apples[i].height>>apples[i].qe; } cout<<mx(n, s, a, b, apples); return 0; }

    userId_undefined

    复仇者_黑客_ZDZL

    出道萌新
    28阅读
    0回复
    0点赞
  • 抄

    #include <bits/stdc++.h> using namespace std; struct Apple { int height, qe; }; bool rt(const Apple& a, const Apple& b) { return a.qe < b.qe; } int mx(int n, int s, int a, int b, vector<Apple>& apples) { sort(apples.begin(), apples.end(), rt); } int main() { int n, s, a, b; cin >> n >> s >> a >> b; vector<Apple> apples(n); for (int i = 0; i < n; ++i) { cin >> apples[i].height >> apples[i].qe; } cout << mx(n, s, a, b, apples) << endl; return 0; }

    userId_undefined

    塔塔

    空间掌握者分支·分支解题者循环·循环打卡人字符串·魔法使递归·套娃学徒倔强青铜
    11阅读
    0回复
    0点赞
  • 题---解

    提交记录被我拉到100次了 通过率:72.00% ——————————————————————————————————————————— 感觉我这种有点麻烦

    userId_undefined

    qianqian

    空间掌握者出道萌新倔强青铜
    4阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页