반응형
요약 : x와 y 입력 후 해당 좌표가 몇 사분면인지 확인하는 문제
소스코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <iostream>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a,b;
cin >> a >> b;
if(a>0&&b>0) cout << "1" << endl;
else if(a<0&&b>0) cout << "2" << endl;
else if(a<0&&b<0) cout << "3" << endl;
else cout << "4" << endl;
return 0;
}
|
cs |
정답 확인
반응형
'category > 백준 알고리즘 c++' 카테고리의 다른 글
백준 알고리즘 8393번 합 c++ (0) | 2020.12.04 |
---|---|
백준 알고리즘 10950번 A+B-3 c++ (0) | 2020.12.04 |
백준 알고리즘 2739번 구구단 c++ (0) | 2020.12.04 |
백준 알고리즘 2884번 알람 시계 c++ (0) | 2020.12.03 |
백준 알고리즘 2753번 윤년 c++ (0) | 2020.12.03 |
백준 알고리즘 9498번 시험 성적 c++ (0) | 2020.12.03 |
백준 알고리즘 1330번 두 수 비교하기 c++ (0) | 2020.12.03 |
백준 알고리즘 2588번 곱셈 c++ (0) | 2020.12.03 |
댓글