python mooc 不同分数分级_1080 MOOC期终成绩 (25 分) python

最后一个测试点答案错误,得19分,老哥们看看是为啥

P,M,N = map(int, input().split(" "))

dict1 = {}

for i in range(P):

ipt_list = input().split(" ")

ipt_list[1] = int(ipt_list[1])

if ipt_list[0] not in dict1.keys():

dict1[ipt_list[0]] = [-1, -1, -1, -1]

dict1[ipt_list[0]][0] = ipt_list[1]

else:

dict1[ipt_list[0]][0] = ipt_list[1]

for i in range(M):

ipt_list = input().split(" ")

ipt_list[1] = int(ipt_list[1])

if ipt_list[0] not in dict1.keys():

dict1[ipt_list[0]] = [-1, -1, -1, -1]

dict1[ipt_list[0]][1] = ipt_list[1]

else:

dict1[ipt_list[0]][1] = ipt_list[1]

for i in range(N):

ipt_list = input().split(" ")

ipt_list[1] = int(ipt_list[1])

if ipt_list[0] not in dict1.keys():

dict1[ipt_list[0]] = [-1, -1, -1, -1]

dict1[ipt_list[0]][2] = ipt_list[1]

else:

dict1[ipt_list[0]][2] = ipt_list[1]

for i in dict1.keys():

if dict1[i][1] > dict1[i][2]:

dict1[i][3] = str(float(dict1[i][1] * 0.4 + dict1[i][2]*0.6))

a,b = dict1[i][3].split(".")

if int(b[0]) > 5:

dict1[i][3] = int(a) + 1

else:

dict1[i][3] = int(a)

else:

dict1[i][3] = dict1[i][2]

#dict1 = {'01234': [880, 39, 58, 58], 'a1903': [199, 86, 66, 74], 'ydjh2': [200, 98, 82, 88], 'wehu8': [300, 55, 84, 84], 'dx86w': [220, 88, 81, 84], 'missing': [400, -1, 99, 99], 'ydhfu77': [-1, 99, 88, 92]}

dict2 = {}

print(dict1)

for k,v in dict1.items():

if v[0]<200 or v[3]<60:

continue

# v = map(str,v)

# print(k," ".join(v))

dict2[k] = v

dict2_list = sorted(dict2.items(),key=lambda a:(-a[1][3],a[0]))

for i in dict2_list:

a = map(str,i[1])

print(i[0]," ".join(a))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值