728x90

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

#include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr);
int a, b, c;
cin >> a >> b >> c;
if (a == b && b == c && a == c) {
cout << 10000 + a * 1000;
} else if (a == b) {
cout << 1000 + a * 100;
} else if (b == c) {
cout << 1000 + b * 100;
} else if (a == c) {
cout << 1000 + c * 100;
} else {
cout << max({a, b, c}) * 100;
}
}
// Authored by : BaaaaaaaaaaarkingDog
// Co-authored by : -
// http://boj.kr/0b6d46b39f7c4fc8afd6d0c7d21e7bad
// #include <bits/stdc++.h>
// using namespace std;
// int main(void) {
// ios::sync_with_stdio(0);
// cin.tie(0);
// int a, b, c;
// cin >> a >> b >> c;
// if (a == b && b == c)
// cout << 10000 + a * 1000;
// else if (a == b || a == c)
// cout << 1000 + a * 100;
// else if (b == c)
// cout << 1000 + b * 100;
// else
// cout << max({a, b, c}) * 100;
// }
// Authored by : BaaaaaaaaaaarkingDog
// Co-authored by : -
// http://boj.kr/a66f45063a2a4f1bb9816a2080077fe3
// #include <bits/stdc++.h>
// using namespace std;
// int main(void) {
// ios::sync_with_stdio(0);
// cin.tie(0);
// int a[3];
// cin >> a[0] >> a[1] >> a[2];
// sort(a, a + 3);
// if (a[0] == a[2])
// cout << 10000 + a[0] * 1000; // 세 수가 동일
// else if (a[0] == a[1] || a[1] == a[2])
// cout << 1000 + a[1] * 100; // 두 수가 동일
// else
// cout << a[2] * 100;
// }
// #include <bits/stdc++.h>
// using namespace std;
// int main() {
// ios::sync_with_stdio(false), cin.tie(nullptr);
// int a, b, c;
// cin >> a >> b >> c;
// if (a == b && b == c && c == a) {
// cout << 10000 + (a * 1000);
// } else if (a == b || a == c) {
// cout << 1000 + (a * 100);
// } else if (b == c) {
// cout << 1000 + (b * 100);
// } else {
// a > b ? (a > c ? cout << a * 100 : cout << c * 100) : (b > c ? cout << b
// * 100 : cout << c * 100);
// }
// }
/*
주사위(2480)
O(1)
3개의 눈이 같을 경우
(a == b && a == c)
2개의 눈이 같을 경우
(a == b) || (a == c) || (b == c)
같은 눈이 없을 경우 배열의 마지막 값을 이용하면 된다(sort 되어 있으므로)
*/
view raw bj_2480.cpp hosted with ❤ by GitHub

 

'Algorithm > C&C++' 카테고리의 다른 글

백준 2562번: 최댓값(c/c++, c/cpp)  (0) 2021.10.05
백준 2490번: 윷놀이(c/c++, c/cpp)  (0) 2021.10.05
백준 2753번: 윤년(c++)  (0) 2021.09.29
백준 1000번: A+B(c++)  (0) 2021.09.27
백준 2752번: 세수정렬 c++(cpp)  (0) 2021.09.06

+ Recent posts