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

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

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

    #include <bits/stdc++.h> using namespace std; struct ban{ string name; long long sg,id; }; bool cmp(ban a,ban b){ if(a.sg!=b.sg) return a.sg>b.sg; else return a.id<b.id; } int main(){ int a; cin>>a; ban b[a]; for(int c=0;c<a;c++){ cin>>b[c].name>>b[c].sg>>b[c].id; } sort(b,b+a,cmp); cout<<b[0].name<<' '<<b[0].sg<<' '<<b[0].id; return 0; }

    userId_undefined

    邓老登━╋══正版═══➢

    30阅读
    1回复
    0点赞
  • 无需排序,简单代码

    userId_undefined

    ☯

    空间掌握者字符串·魔法使递归·套娃学徒枚举·枚举小能手模拟·模拟练习生数组·数组操作员
    12阅读
    1回复
    1点赞
  • 双击 关注

    #include<bits/stdc++.h> #include<algorithm> using namespace std; struct student{ string name; int id; double h; }a[110]; bool cmp(student x,student y){ if(x.h!=y.h)return x.h>y.h; else return x.id<y.id; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].name>>a[i].h>>a[i].id; } sort(a+1,a+n+1,cmp); cout<<a[1].name<<" "<<a[1].h<<" "<<a[1].id; return 0; }

    userId_undefined

    刘宥岐

    8阅读
    0回复
    0点赞
  • 题解

    userId_undefined

    zsy

    题解仙人7月全勤卷王出道萌新时间刺客时空双修者秩序白银
    2阅读
    0回复
    0点赞
首页