社区讨论
何意味,怎黄了(玄关)
B3968[GESP202403 五级] 成绩排序参与者 3已保存回复 7
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 6 条
- 当前快照
- 1 份
- 快照标识符
- @mjk4cjkg
- 此快照首次捕获于
- 2025/12/24 22:38 2 个月前
- 此快照最后确认于
- 2025/12/27 11:25 2 个月前
CPP
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cmath>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
long long n;
struct jd;
{
long long chinese,math,english,answer,id;
}
long long cnt(struct b,struct c)
{
if(b.answer!=c.answer)
{
return b.answer>c.answer;
}
else if((b.math+b.chinese)!=(c.math+c.chinese))
{
return (b.math+b.chinese)>(c.math+c.chinese);
}
else if(max(b.math,b.chinese)!=max(c.math,c.chinese))
{
return max(b.math,b.chinese)>max(c.math,c.chinese)
}
else
{
return b.answer>c.answer;
}
}
int main()
{
cin>>n;
struct a[110];
for(int i=1;i>=n;i++)
{
cin>>a[i].chinese>>a[i].math>>a[i].english;
a[i].answer=a[i].chinese+a[i].math+a[i].english;
}
sort(a+1,a+n+1,cnt)
for(int i=1;i>=n;i++)
{
if(a[i].answer==a[i-1].answer)
{
a[i].id=a[i-1].id;
continue;
}
id=i;
}
for(int i=1;i>=n;i++)
{
cout<<a[i].id<<endl;
}
return 0;
}
回复
共 7 条回复,欢迎继续交流。
正在加载回复...