Recent Posts
Notice
No Rules Rules
사분면 고르기 (feat. 백준, 14681번) 본문
728x90
반응형
사분면 고르기
https://www.acmicpc.net/problem/14681
14681번: 사분면 고르기
점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다.
www.acmicpc.net
반응형
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(NULL);
register int x, y;
cin >> x >> y;
if (x > 0 && y > 0)
cout << 1;
else if (x < 0 && y > 0)
cout << 2;
else if (x < 0 && y < 0)
cout << 3;
else
cout << 4;
return 0;
}
// *&)*@*
주어진 입력값 x,y를 0을 기준으로 비교하면 분면을 구할 수 있습니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
오븐 시계 (feat. 백준, 2525번) (0) | 2022.08.09 |
---|---|
알람 시계 (feat. 백준, 2884번) (0) | 2022.08.09 |
윤년 (feat. 백준, 2753번) (0) | 2022.08.09 |
시험 성적 (feat. 백준, 9498번) (0) | 2022.08.09 |
새싹 (feat. 백준, 25083번) (0) | 2022.08.09 |
Comments