본문 바로가기

Algorithm/Implementation

(C++) - 백준(BOJ) 13623 : Zero or One

반응형

https://www.acmicpc.net/problem/13623

 

13623번: Zero or One

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; pro

www.acmicpc.net

입출력,  if문을 사용해보는 문제였습니다.

📕 풀이방법

📔 입력 및 초기화

a, b, c를 선언 후 입력받습니다.

📔 정답출력

모두 같으면 '*'를, 한 명만 다르면 그 사람이 이기므로 그 사람의 이름을 출력해줍니다.


📕 Code

#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main(){
    cin >> a >> b >> c;
    if(a == b && b == c) cout << '*';
    else if(a == b) cout << 'C';
    else if(a == c) cout << 'B';
    else if(b == c) cout << 'A';
}