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

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 资讯
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 看我超级大陆!!!

    #include<bits/stdc++.h> #include<cmath> using namespace std; struct stu{ int id; int sc; }; bool cmp(stu a, stu b){ if(a.sc != b.sc){ return a.sc > b.sc; } return a.id < b.id; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int m, n; cin >> m >> n; stu st[114514]; for(int i = 0; i < m; i++){ cin >> st[i].id >> st[i].sc; } sort(st, st + m, cmp); //计算面试分数线 int li = (int)(n * 1.5) - 1; int ls = st[li].sc; //统计面试人数 int cnt = 0; for(int i = 0; i < m; i++){ if(st[i].sc >= ls){ cnt++; }else{ break; } } cout << ls << " " << cnt << endl; for(int i = 0; i < cnt; i++){ cout << st[i].id << " " << st[i].sc << endl; } return 0; }

    userId_undefined
    改行当K佬
    时间刺客字符串·魔法使贪心·贪心尝试者ASCII炼金师数组·数组操作员维度操控者
    3阅读
    0回复
    0点赞
暂无数据

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

首页