Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- ChatGPT
- programmers
- 우분투
- Baekjoon
- SW Expert Academy
- 편스토랑 우승상품
- 프로그래머스
- 금융문자분석경진대회
- hackerrank
- ubuntu
- Git
- 자연어처리
- 편스토랑
- 파이썬
- Kaggle
- leetcode
- gs25
- Docker
- AI 경진대회
- 캐치카페
- dacon
- github
- 데이콘
- PYTHON
- 프로그래머스 파이썬
- 코로나19
- 백준
- Real or Not? NLP with Disaster Tweets
- 맥북
- 더현대서울 맛집
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 2822번 : 점수 계산 (Python) 본문
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 점수 계산 입니다.
2822번: 점수 계산
8개 줄에 걸쳐서 각 문제에 대한 참가자의 점수가 주어진다. 점수는 0보다 크거나 같고, 150보다 작거나 같다. 모든 문제에 대한 점수는 서로 다르다. 입력으로 주어지는 순서대로 1번 문제, 2번 문
www.acmicpc.net
👨🏻💻 코드 ( Solution )
def calculate_score(scores):
score_list = []
for idx, score in enumerate(scores, start=1):
score_list.append((idx, score))
score_list = sorted(score_list, key=lambda x: -x[1])[:5]
answer_idx = list(map(str, sorted([idx[0] for idx in score_list])))
answer_score = [score[1] for score in score_list]
return sum(answer_score), " ".join(answer_idx)
if __name__ == "__main__":
scores = []
for _ in range(8):
score = int(input())
scores.append(score)
answer = calculate_score(scores=scores)
for ans in answer:
print(ans)
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[Programmers] 탐욕법(Greedy) - 큰 수 만들기 (Python) (0) | 2022.02.22 |
---|---|
[Programmers] 2019 KAKAO BLIND RECRUITMENT - 오픈채팅방 (Python) (0) | 2022.02.21 |
[Programmers] 피보나치 수 (Python) (0) | 2022.02.19 |
[Programmers] 월간 코드 챌린지 시즌3 - n^2 배열 자르기 (Python) (0) | 2022.02.18 |
[Programmers] 2018 KAKAO BLIND RECRUITMENT [1차] 다트 게임 (Python) (0) | 2022.02.17 |