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

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 终于AC了!

    userId_undefined

    man(但圣蛋)

    出道萌新时间刺客空间掌握者模拟·模拟练习生秩序白银
    25阅读
    0回复
    1点赞
  • 123

    #include<bits/stdc++.h> using namespace std; int n,m; struct node{ int b,c; }; bool cmp(node x,node y){ if(x.cy.c){ return x.b<y.b; }else if(x.c!=y.c){ return x.c<y.c; } } int main(){ cin>>n>>m; node man[n+5]; if(m0){ cout<<0; return 0; }else if(m==1){ int x; cin>>x; cout<<x; return 0; } for(int i=1;i<=m;i++){ cin>>man[i].b; man[i].c=abs(man[i].b-n); } sort(man+1,man+m+1,cmp); cout<<man[1].b; return 0; }

    userId_undefined

    186****6957

    倔强青铜时空双修者贪心·贪心尝试者递归·套娃学徒字符串·魔法使分治·分治练习生
    10阅读
    0回复
    1点赞
暂无数据

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

首页