from re import I # -*- coding:utf-8 -*- class Gift: def getValue(self, gifts, n): d={} k=n/2 for item in gifts: if item not in d.keys(): d[item]=1 else: d[item]=d[item]+1 if float(d[item])>k: return item return 0 #感谢腾讯出的简单题目
from re import I # -*- coding:utf-8 -*- class Gift: def getValue(self, gifts, n): d={} k=n/2 for item in gifts: if item not in d.keys(): d[item]=1 else: d[item]=d[item]+1 if float(d[item])>k: return item return 0 #感谢腾讯出的简单题目