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 |
Tags
- hackerrank
- github
- 파이썬
- 백준
- 프로그래머스 파이썬
- SW Expert Academy
- ubuntu
- Real or Not? NLP with Disaster Tweets
- 금융문자분석경진대회
- gs25
- 더현대서울 맛집
- ChatGPT
- leetcode
- Baekjoon
- 캐치카페
- Docker
- 프로그래머스
- 데이콘
- 맥북
- programmers
- Git
- dacon
- 편스토랑
- 자연어처리
- Kaggle
- 편스토랑 우승상품
- 우분투
- PYTHON
- 코로나19
- AI 경진대회
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 5523번 : 경기 결과 (Python) 본문
728x90
반응형
![](http://t1.daumcdn.net/tistory_admin/static/images/xBoxReplace_250.png)
코딩 1일 1문제! 오늘의 문제는 백준의 경기 결과 입니다.
5523번: 경기 결과
A와 B가 게임을 한다. 게임은 N번의 라운드로 이루어져 있다. 각 라운드에서는, 더 많은 점수를 얻은 사람이 그 라운드의 승자가 된다. 즉, A의 점수가 B의 점수보다 크면 i번째 라운드는 A의 승리
www.acmicpc.net
👨🏻💻 코드 ( Solution )
import sys
def match_result(match_scores):
a_team, b_team = 0, 0
for score in match_scores:
a_score, b_score = score[0], score[1]
if a_score > b_score:
a_team += 1
elif a_score < b_score:
b_team += 1
return f"{a_team} {b_team}"
if __name__ == "__main__":
N = int(sys.stdin.readline())
match_scores = []
for _ in range(N):
a_score, b_score = map(int, sys.stdin.readline().split())
match_scores.append((a_score, b_score))
print(match_result(match_scores))
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문제' 카테고리의 다른 글
[BaekJoon] 8370번 : Plane (Python) (0) | 2022.05.10 |
---|---|
[BaekJoon] 6749번 : Next in line (Python) (0) | 2022.05.09 |
[BaekJoon] 1235번 : 학생 번호 (Python) (0) | 2022.05.07 |
[BaekJoon] 14918번 : 더하기 (Python) (0) | 2022.05.06 |
[BaekJoon] 16199번 : 나이 계산하기 (Python) (0) | 2022.05.05 |