擅长:python、mysql、java
<p>不使用任何导入和更少的代码,可以这样做。
我还把它放进了一个函数中,只是为了让它更干净一点,所以如果需要的话,你可以在其他地方重用它</p>
<pre><code>def main():
scores_dict = {}
for _ in range(int(input())):
name, score = input(), float(input())
if score not in scores_dict:
scores_dict[score] = []
scores_dict[score].append(name)
# Delete the min score key and names so that we can grab the second min
del scores_dict[min(scores_dict.keys())]
# Get new min score.
min_score = min(scores_dict.keys())
# Sort new min score.
scores_dict[min_score].sort()
# Print each name in results
[print(i) for i in scores_dict[min_score]]
if __name__ == '__main__':
main()
</code></pre>