본문 바로가기
공부/코딩테스트

백준: 13623번 Zero or One (Python3)

by 혼밥맨 2022. 8. 5.
반응형

백준: 13623번 Zero or One (Python3)

Zero or One 성공다국어

 
시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB 635 545 489 87.011%

문제

3명 이상의 플레이어 중 승자를 결정하는 데 사용되는 Zero or One(브라질의 일부 ​​지역에서는 Two or One이라고도 함)이라는 게임은 누구나 알고 있을 것입니다. 익숙하지 않은 사람들을 위해 게임은 다음과 같이 작동합니다. 각 플레이어는 0 또는 1 사이의 값을 선택합니다. 명령(일반적으로 참가자 중 한 명이 "0 또는 ... 하나!"라고 발표)에 의해 프롬프트되면 모든 참가자는 손을 사용하여 선택한 값을 표시합니다. 선택한 값이 1이면 참가자는 확장된 집게 손가락으로 손을 표시합니다. 선택한 값이 0이면 참가자는 모든 손가락이 닫힌 손을 보여줍니다. 승자는 남들과 다른 가치를 선택한 사람이다. 다른 모든 플레이어와 다른 값을 가진 플레이어가 없는 경우(예: 모든 플레이어가 0을 선택하거나 일부 플레이어가 0을 선택하고 일부 플레이어가 1을 선택하는 경우) 승자는 없습니다.

Alice, Bob, Clara는 좋은 친구이며 항상 Zerinho를 플레이합니다. 영화 세션 중에 누가 팝콘을 살지, 누가 먼저 수영장에 들어갈지 등을 결정하기 위해. 그들은 너무 많이 플레이하여 Zerinho를 플레이할 플러그인을 만들기로 결정했습니다. 페이스 북에서. 하지만 컴퓨터 프로그래밍을 할 줄 몰라서 당신을 포함하여 아는 친구들에게 작업을 나누어 주었습니다.

Alice, Bob, Clara가 선택한 세 가지 값이 각각 0 또는 1인 경우 승자가 있는지 결정하고 이 경우 승자가 누구인지 결정하는 프로그램을 작성하십시오.

Everyone probably knows the game Zero or One (in some regions in Brazil also known as Two or One), used to determine a winner among three or more players. For those unfamiliar, the game works as follows. Each player chooses a value between zero or one; prompted by a command (usually one of the contestants announces “Zero or... One!”), all participants show the value chosen using a hand: if the value chosen is one, the contestant shows a hand with an extended index finger; if the value chosen is zero, the contestant shows a hand with all fingers closed. The winner is the one who has chosen a value different from all others. If there is no player with a value different from all others (e.g. all players choose zero, or some players choose zero and some players choose one), there is no winner.

Alice, Bob and Clara are great friends and play Zerinho all the time: to determine who will buy popcorn during the movie session, who will enter the swimming pool first, etc.. They play so much that they decided make a plugin to play Zerinho on Facebook. But since the don’t know how to program computers, they divided the tasks among friends who do know, including you.

Given the three values chosen by Alice, Bob and Clara, each value zero or one, write a program that determines if there is a winner, and in that case determines who is the winner.

입력

입력에는 Alice, Beto 및 Clara가 선택한 값을 각각 나타내는 세 개의 정수 A, B 및 C가 있는 단일 행이 포함됩니다.

The input contains a single line, with three integers A, B and C ,indicating respectively the values chosen by Alice, Beto and Clara.

Restrictions

  • A, B, C ∈ {0, 1}

출력

프로그램은 단일 문자를 포함하는 단일 행을 출력해야 합니다. 앨리스가 승자라면 캐릭터는 'A', 베토가 승자라면 캐릭터는 'B', 클라라가 승자라면 캐릭터는 'C', 승자가 없다면 캐릭터는 ' *'(별표).
Your program must output a single line, containing a single character. If Alice is the winner the character must be ‘A’, if Beto is the winner the character must be ‘B’, if Clara is the winner the character must be ‘C’, and if there is no winner the character must be ‘*’ (asterisc).

예제 입력 1 

1 1 0

예제 출력 1 

C

예제 입력 2 

0 0 0

예제 출력 2 

*

예제 입력 3 

1 0 0

예제 출력 3 

A

답안

1
2
3
4
5
6
7
8
9
10
lst_=list(map(int, input().split()))
 
if lst_[0]==lst_[1and lst_[0]==lst_[-1]:
    print("*")
elif lst_[0]!=lst_[1and lst_[0]!=lst_[-1and lst_[1]==lst_[-1]:
    print("A")
elif lst_[1]!=lst_[0and lst_[1]!=lst_[-1and lst_[0]==lst_[-1]:
    print("B")
else:
    print("C")
cs

반응형

댓글