Created
January 2, 2014 20:21
-
-
Save beholderrk/8226049 to your computer and use it in GitHub Desktop.
http://informatics.mccme.ru/moodle/mod/statements/view3.php?id=270&chapterid=1440#1 Спортсмен Василий участвовал в соревнованиях по хоккейболу и получил в личном зачете серебряную медаль. Известно, что участники, получившие одинаковое количество очков, награждаются одинаковыми наградами. Известно, что были разыграны золотые серебряные и бронзовы…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# task1440.py | |
n = int(raw_input('')) | |
scores = raw_input('') | |
scores = [ int(x) for x in scores.split(' ') if x ] | |
max1 = max(scores[0], scores[1]) | |
max2 = min(scores[0], scores[1]) | |
for i in xrange(2, len(scores)): | |
if scores[i] > max1: | |
max2 = max1 | |
max1 = scores[i] | |
elif scores[i] > max2 and max1 != scores[i]: | |
max2 = scores[i] | |
elif max1 == max2: | |
max2 = scores[i] | |
print max2 |
Зачем последние условие? Результаты не могут совпадать, исходя из других условий.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
задачу нужно решить без сортировок и set, как-то коряво получилось