하하하 하기 싫은 일 산더미
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

풀이
비트논리연산을 사용하였다. 입력이 0 아님 1이기 때문에 조건문을 아주 보기 좋게 잘 적은 것 같아 기분이 좋다.
시간 복잡도 : O(1)
소요 시간 : 1분
아쉬운 점 : 없다 너무 잘 풀었다.
전체적인 감상 : 이 문제 너무 잘 푼 것 같다 만족스럽다.
/* basic setup {{{ */ #include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define sz(x) ((int)x.size()) #define all(x) x.begin(),x.end() #define compress(x) sort(all(x)), x.erase(unique(all(x)), x.end()) #define fast_io ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef const int ci; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; /*}}}*/ int main(){ fast_io; bool a,b,c; cin>>a>>b>>c; if(a&b&c || !(a|b|c)) cout<<'*'; else if(!(b^c)) cout<<'A'; else if(!(a^c)) cout<<'B'; else cout<<'C'; cout<<'\n'; }
'백준 문제 해설' 카테고리의 다른 글
백준 25591 푸앙이와 종윤이 (0) | 2022.11.19 |
---|---|
백준 25703 포인터 공부 (0) | 2022.11.18 |
백준 8558 Silnia (0) | 2022.11.17 |
백준 18398 HOMWRK (0) | 2022.11.16 |
백준 24860 Counting Antibodies (0) | 2022.11.14 |
백준 4714 Lunacy (0) | 2022.11.13 |
백준 16099 Large Sport Facility (0) | 2022.11.12 |
백준 3056 007 (0) | 2022.11.11 |