score=[]
index=[]
for i in range(8):
tmp = int(input())
score.append(tmp)
sort_list=score[:]
sort_list.sort(reverse=True)
for i in range(5):
index.append(score.index(sort_list[i])+1)
index.sort()
print(sum(sort_list[0:5]))
for i in index:
print(i,end=' ')
score - 입력받은 점수들 저장하는 리스트
sort_list - score의 정렬들을 저장하는 리스트
index - sort_list의 값들과 score에 있는 원소들과 같은 것끼리 index모아서 저장
합을 출력할때는 인덱스를 이용해 범위를 조정하고
반복문을 이용해 sort된 인덱스들을 출력
'자기개발👨💻 > 코딩 알고리즘' 카테고리의 다른 글
[python] 백준 2480 주사위 세개 (2) | 2020.12.27 |
---|---|
[python] 백준 1251 단어 나누기 (0) | 2020.12.25 |
코딩테스트 한 번에 작성한것들,, (0) | 2020.10.22 |
[python] 백준 10101 삼각형외우기 (0) | 2020.08.29 |
[python] 백준 1731 추론 (0) | 2020.08.29 |
[python] 백준 1547 공 (0) | 2020.08.29 |