1077. 互评成绩计算 (20)

def judge(string_2, perfect_scores):
	#计算每组的得分
	string = string_2[1:]
	list_scores = []
	sum = 0
	for num in string:
		if int(num) >= 0 and int(num) <= int(perfect_scores):
			list_scores.append(int(num))
	list_scores.sort()
	list_scores = list_scores[1:-1]
	for num in list_scores:
		sum += num
	length = len(list_scores)
	scores = sum / length
	my_scores = (int(string_2[0]) + scores) // 2
	remainder = (int(string_2[0]) + scores) / 2
	if (remainder - my_scores) >= 0.5:
		my_scores += 1
	print(int(my_scores))	

if __name__ == '__main__':
	string_1 = input().split()
	number_of_guys, perfect_scores = int(string_1[0]), int(string_1[1])
	for i in range(number_of_guys):
		string_2 = input().split()
		judge(string_2, perfect_scores)
	

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值