Recent Posts
Notice
No Rules Rules
네 번째 점 (feat. 백준, 3009번) 본문
728x90
반응형
네 번째 점
https://www.acmicpc.net/problem/3009
반응형
// woohyeon.kim
// https://www.acmicpc.net/problem/3009
#include <iostream>
#include <map>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(NULL);
map<int, int> x_pos, y_pos;
for (register int i = 0, x, y; i < 3; ++i)
cin >> x >> y, ++x_pos[x], ++y_pos[y];
register int x_ans = 0, y_ans = 0;
for (auto& pos : x_pos)
if (pos.second & 1) {
x_ans = pos.first;
break;
}
for (auto& pos : y_pos)
if (pos.second & 1) {
y_ans = pos.first;
break;
}
cout << x_ans << " " << y_ans;
return 0;
}
// *&)*@*
- 정사각형이라면 좌측 위의 점, 좌측 아래의 점, 우측 위의 점, 우측 아래의 점 4개에 대한 x,y가 각각 짝수여야 합니다.
- 즉, 입력받은 3개의 x,y에 대해서 홀수인 x와 y가 정답이 됩니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
참외밭 (feat. 백준, 2477번) (0) | 2022.08.03 |
---|---|
직각삼각형 (feat. 백준, 4153번) (0) | 2022.08.03 |
직사각형에서 탈출 (feat. 백준, 1085번) (0) | 2022.08.03 |
서로 다른 부분 문자열의 개수 (feat. 백준, 11478번) (0) | 2022.08.03 |
대칭 차집합 (feat. 백준, 1269번) (0) | 2022.08.03 |
Comments