본문 바로가기
C++

[프로그래머스] 점의 위치 구하기

by 띰쥬 2025. 9. 4.
728x90
반응형
SMALL

#include <string>
#include <vector>

using namespace std;

int solution(vector<int> dot) {
    bool x,y;
    
    x = dot[0]>0?1:0;
    y = dot[1]>0?1:0;
    
    if(x && y) return 1;
    else if(!x && y) return 2;
    else if(!x && !y) return 3;
    else if(x && !y) return 4;
}

728x90
반응형
LIST

댓글