※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※
이번에 볼 문제는 백준 7782번 문제인 Alien이다.
문제는 아래 링크를 확인하자.
https://www.acmicpc.net/problem/7782
7782번: Alien
Once upon a time after winning another competition at KBTU, Bakhytzhan, Askar and Artem walked throw the Old Square. When they found some interesting rectangle lines on the asphalt, they stopped and screamed out ”R tree”. They screamed so loud that all
www.acmicpc.net
주어지는 N개의 직사각형 영역 중 좌표
이는 반복문과 조건문을 적절히 이용해 알아낼 수 있다.
아래는 제출한 소스코드이다.
#include <iostream>
using namespace std;
typedef long long ll;
int N;
int x, y;
int X1, Y1, X2, Y2;
bool chk = 0;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> x >> y;
while (N--) {
cin >> X1 >> Y1 >> X2 >> Y2;
if (X1 <= x && x <= X2 && Y1 <= y && y <= Y2) chk = 1;
}
if (chk) cout << "Yes";
else cout << "No";
}
728x90
'BOJ' 카테고리의 다른 글
[BOJ 24080 // C++] 複雑な文字列 (Complex String) (0) | 2022.12.10 |
---|---|
[BOJ 24803 // C++] Provinces and Gold (0) | 2022.12.09 |
[BOJ 10168 // C++] 파발마 (0) | 2022.12.09 |
[BOJ 26145 // C++] 출제비 재분배 (0) | 2022.12.09 |
[BOJ 23663 // C++] Deja vu of Go Players (0) | 2022.12.09 |