http://noi.openjudge.cn/ch0109/07/
""" 1.9 编程基础之顺序查找 07 不与最大数相同的数字之和 方法二(python3实现) http://noi.openjudge.cn/ch0109/07/ Python List max()方法 https://www.runoob.com/python/att-list-max.html """ n=int(input()) a=list(map(int,input().split())) maxa=max(a) lena=len(a) #print(lena) """ max=-1000000-10 i=0 while i<lena: if a[i]>max: max=a[i] i+=1 #print(max) """ ans=0 i=0 while i<lena: if a[i]!=maxa: ans+=a[i] i+=1 print(ans)
参考:
Python List max()方法
https://www.runoob.com/python/att-list-max.html