반응형
백준: 14038번 Tournament Selection (Python3)
Tournament Selection 성공다국어
시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 | 512 MB | 1576 | 1028 | 954 | 66.620% |
문제
Each player in a tournament plays six games. There are no ties. The tournament director places the players in groups based on the results of games as follows:
- if a player wins 5 or 6 games, they are placed in Group 1;
- if a player wins 3 or 4 games, they are placed in Group 2;
- if a player wins 1 or 2 games, they are placed in Group 3;
- if a player does not win any games, they are eliminated from the tournament.
Write a program to determine which group a player is placed in
입력
The input consists of six lines, each with one of two possible letters: W (to indicate a win) or L (to indicate a loss).
출력
The output will be either 1, 2, 3 (to indicate which Group the player should be placed in) or -1 (to indicate the player has been eliminated).
예제 입력 1
W
L
W
W
L
W
예제 출력 1
2
예제 입력 2
L
L
L
L
L
L
예제 출력 2
-1
답안
1
2
3
4
5
6
7
8
9
10
11
12
|
lst=[]
for i in range(6):
lst.append(input())
if lst.count("W")>=5:
print("1")
elif lst.count("W")>=3:
print("2")
elif lst.count("W")>=1:
print("3")
elif lst.count("W")==0:
print("-1")
|
cs |
반응형
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 15610번 Abbey Courtyard (Python3) (0) | 2022.08.06 |
---|---|
백준: 14065번 Gorivo (Python3) (0) | 2022.08.05 |
백준: 13985번 Equality (Python3) (0) | 2022.08.05 |
백준: 13866번 팀 나누기 (Python3) (0) | 2022.08.05 |
백준: 13623번 Zero or One (Python3) (0) | 2022.08.05 |
댓글