본문 바로가기

Algorithm

C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 9610번:사분면 답

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;
int q1, q2, q3, q4, ax, x, y, t;
int main() {
    cin >> t;
    while (t--)
    {
        cin >> x >> y;
        if (x == || y == 0) { ax++; }
        else if (x > && y > 0)
            q1++;
        else if (x < && y>0)
            q2++;
        else if (x < && y < 0)
            q3++;
        else if (x > && y < 0)
            q4++;
    }
    cout << "Q1: " << q1 << '\n';
    cout << "Q2: " << q2 << '\n';
    cout << "Q3: " << q3 << '\n';
    cout << "Q4: " << q4 << '\n';
    cout << "AXIS: " << ax << '\n';
}
cs