acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 题解

    userId_undefined

    法兰西玫瑰

    倔强青铜
    28阅读
    0回复
    1点赞
  • AC了好吧

    #include<iostream> #include<algorithm> using namespace std; struct mark{ int a,h; }; mark stu[5000]; bool cmp(mark x,mark y){ if(x.a>y.a) return 1; if(x.a==y.a&&x.h<y.h) return 1; return 0; } int main(){ int n,m,pass,s=0; cin>>n>>m; for(int i=0;i<n;i++){ cin>>stu[i].h>>stu[i].a; //循环,输入考试者的成绩与号数 } sort(stu,stu+n,cmp); pass=stu[m*3/2-1].a; //计算分数线 for(int i=0;i<n;i++){ if(stu[i].a>=pass) s++;//计算通过人数 } cout<<pass<<" "<<s<<endl; for(int i=0;i<s;i++) //输出通过总人数 cout<<stu[i].h<<" "<<stu[i].a<<endl; return 0; //好习惯 }

    userId_undefined

    .Dream.

    倔强青铜
    22阅读
    0回复
    1点赞
  • 题解如下

    userId_undefined

    寒香舞

    倔强青铜
    6阅读
    1回复
    1点赞
  • 结构体排序

    userId_undefined

    回来看看

    倔强青铜
    3阅读
    0回复
    0点赞
  • 题解

    userId_undefined

    准

    倔强青铜
    3阅读
    0回复
    0点赞
首页