CCF-CSP练习 期末预测之最佳阈值

CCF-CSP练习 期末预测之最佳阈值

CCF 202012-2 期末预测之最佳阈值


题目背景

在这里插入图片描述

题目描述

在这里插入图片描述

输入格式

在这里插入图片描述

输出格式

在这里插入图片描述

样例1输入

6
0 0
1 0
1 1
3 1
5 1
7 1

样例1输出

3

样例1解释

在这里插入图片描述

样例2输入

8
5 1
5 0
5 0
2 1
3 0
4 0
100000000 1
1 0

样例1输出

100000000

子任务

在这里插入图片描述


我的提交

#include<bits/stdc++.h>
using namespace std;
struct classmates{
	int y;//安全指数
	int re;//result:0挂科、1未挂科
	int zql;
}c[100005];
int main()
{
	int m,i,j,z=0,max=0;
	cin>>m;
	for(i=1;i<=m;i++)
	{
		cin>>c[i].y>>c[i].re;
	}
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=m;j++)
		{
			if((c[j].y<c[i].y&&c[j].re==0)||(c[j].y>=c[i].y&&c[j].re==1))
				c[i].zql++;
		}
		//cout<<c[i].y<<"的正确率为"<<c[i].zql<<endl;
		if(z<c[i].zql||(z==c[i].zql&&max<c[i].y))
		{
			z=c[i].zql;
			max=c[i].y;
			//cout<<"z和max分别更新为"<<z<<"、"<<max<<endl;
		}
			
	}
	cout<<max<<endl;
}

提交结果

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值