코드 복사/붙여넣기 하는 당신이 아름답습니다.

15973 : 두 박스

풀이

노가다를 해보자~

사실 노가다 안 해도 됨

코드

#include <iostream>
#include <string>
using namespace std;

int x[5], y[5];

string gogo() {
    if (x[0] == x[3] && y[0] == y[3] ||
        x[1] == x[2] && y[0] == y[3] ||
        x[0] == x[3] && y[1] == y[2] ||
        x[1] == x[2] && y[1] == y[2]) return "POINT";
    if (x[0] == x[3] && y[2] <= y[0] && y[0] <= y[3] ||
        x[0] == x[3] && y[2] <= y[1] && y[1] <= y[3] ||
        x[1] == x[2] && y[2] <= y[0] && y[0] <= y[3] ||
        x[1] == x[2] && y[2] <= y[1] && y[1] <= y[3] ||
        x[0] == x[3] && y[0] <= y[2] && y[2] <= y[1] ||
        x[0] == x[3] && y[0] <= y[3] && y[3] <= y[1] ||
        x[1] == x[2] && y[0] <= y[2] && y[2] <= y[1] ||
        x[1] == x[2] && y[0] <= y[3] && y[3] <= y[1] ||
        y[0] == y[3] && x[2] <= x[0] && x[0] <= x[3] ||
        y[0] == y[3] && x[2] <= x[1] && x[1] <= x[3] ||
        y[1] == y[2] && x[2] <= x[0] && x[0] <= x[3] ||
        y[1] == y[2] && x[2] <= x[1] && x[1] <= x[3] ||
        y[0] == y[3] && x[0] <= x[2] && x[2] <= x[1] ||
        y[0] == y[3] && x[0] <= x[3] && x[3] <= x[1] ||
        y[1] == y[2] && x[0] <= x[2] && x[2] <= x[1] ||
        y[1] == y[2] && x[0] <= x[3] && x[3] <= x[1]) return "LINE";
    if (x[2] <= x[0] && x[0] <= x[3] && y[2] <= y[0] && y[0] <= y[3] ||
        x[2] <= x[1] && x[1] <= x[3] && y[2] <= y[1] && y[1] <= y[3] ||
        x[2] <= x[0] && x[0] <= x[3] && y[2] <= y[1] && y[1] <= y[3] ||
        x[2] <= x[1] && x[1] <= x[3] && y[2] <= y[0] && y[0] <= y[3] ||
        x[0] <= x[2] && x[2] <= x[1] && y[0] <= y[2] && y[2] <= y[1] ||
        x[0] <= x[3] && x[3] <= x[1] && y[0] <= y[3] && y[3] <= y[1] ||
        x[0] <= x[2] && x[2] <= x[1] && y[0] <= y[3] && y[3] <= y[1] ||
        x[0] <= x[3] && x[3] <= x[1] && y[0] <= y[2] && y[2] <= y[1] ||
        x[0] <= x[2] && x[3] <= x[1] && y[2] <= y[0] && y[1] <= y[3] ||
        x[0] <= x[2] && x[3] <= x[1] && y[2] <= y[1] && y[1] <= y[3] ||
        x[0] <= x[2] && x[3] <= x[1] && y[2] <= y[0] && y[0] <= y[3] ||
        x[2] <= x[0] && x[1] <= x[3] && y[0] <= y[2] && y[3] <= y[1] ||
        x[2] <= x[1] && x[1] <= x[3] && y[0] <= y[2] && y[3] <= y[1] ||
        x[2] <= x[0] && x[0] <= x[3] && y[0] <= y[2] && y[3] <= y[1]) return "FACE";
    return "NULL";
}

int main() {
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    cout << gogo();
    return 0;
}

아무말

백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

wookje.kwon's profile image

wookje.kwon

2018-08-27 20:19

Read more posts by this author