백준 문제풀이
백준 2490번 - C++
diligent_gideok
2022. 4. 12. 01:46
#include <bits/stdc++.h>
using namespace std;
// 결과를 숫자의 합으로 받고 인덱스로 결과 출력
int result, input;
string res = "DCBAE";
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
for (int i = 0; i < 3; i++) {
result = 0;
for (int j = 0; j < 4; j++) {
cin >> input;
result += input;
}
cout << res[result] << '\n';
}
}
#include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int arr[3][4];
for (int j = 0; j < 3; j++) {
for (int i = 0; i < 4; i++) cin >> arr[j][i];
sort(arr[j], arr[j] + 4);
}
for (int j = 0; j < 3; j++) {
if (arr[j][0] == 1) cout << "E";
else if (arr[j][1] == 1) cout << "A";
else if (arr[j][2] == 1) cout << "B";
else if (arr[j][3] == 1) cout << "C";
else cout << "D";
cout << "\n";
}
}