炸坑超时 PAT (Basic Level) Practice Python解法 1032 挖掘机技术哪家强(不要连等指向/+=1)

  • Post author:
  • Post category:python




炸坑超时 PAT (Basic Level) Practice Python解法 1032 挖掘机技术哪家强(不要连等指向/+=1)



很明显坑点3是因为容器存取超时了,暂时懒得解决了。三分留给10月的我。

import sys
n=int(input())
xxdata = []
cjdata = []#不要写连等,会相同指向疯狂报错!!!

for i in range(n):
    info = sys.stdin.readline()
    school = info[0:info.find(" ")]
    score = info[info.find(" ")+1:]
    
    if school not in xxdata:
        xxdata.append(school)
        cjdata.append(int(score))
    else:
        ind = xxdata.index(school)
        cjdata[ind] += int(score)#+=1
        
maxcj = max(cjdata)
maxxx = xxdata[cjdata.index(maxcj)]
print(maxxx,maxcj)



版权声明:本文为qq_40679293原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。