您当前的位置: 首页 > 

MangataTS

暂无认证

  • 2浏览

    0关注

    423博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

L2-015 互评成绩(排序)

MangataTS 发布时间:2022-04-03 18:56:07 ,浏览量:2

题目链接

https://pintia.cn/problem-sets/994805046380707840/problems/994805062432309248

思路

我们只需要在每一个同学的评分中算出总和评分和最低最高评分即可,对于最高评分,我们定义一个 m a x w max_w maxw​ 初始化为 0.0 0.0 0.0 然后遍历的过程中不断取 max最低分同理,然后我们取一个平均值,放入数组或者容器中,最后排序输出前 m m m 名同学即可

代码
#include
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
#define INF 0x3f3f3f3f

int n,k,m;
vector V;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>k>>m;
	double t;
	for(int i = 1;i t;
			sum += t;
			max_w = max(max_w,t);
			min_w = min(min_w,t);
		}
		sum -= max_w + min_w;
		sum /= k - 2.0;
		V.push_back(sum);
	}
	sort(V.begin(),V.end(),greater());
	cout            
关注
打赏
1665836431
查看更多评论
0.0364s