-
[11758] CCWBOJ 2022. 2. 11. 03:57
https://www.acmicpc.net/problem/11758
11758번: CCW
첫째 줄에 P1의 (x1, y1), 둘째 줄에 P2의 (x2, y2), 셋째 줄에 P3의 (x3, y3)가 주어진다. (-10,000 ≤ x1, y1, x2, y2, x3, y3 ≤ 10,000) 모든 좌표는 정수이다. P1, P2, P3의 좌표는 서로 다르다.
www.acmicpc.net
<문제>
ccw 기본문제
<소스코드>
#include <bits/stdc++.h>using namespace std;typedef struct {int x, y;} point;int ccw(point a, point b, point c) {return (a.x * b.y + b.x * c.y + c.x * a.y) -(b.x * a.y + c.x * b.y + a.x * c.y);}int main(void) {ios_base::sync_with_stdio(0);cin.tie(0);point a, b, c;cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;int ret = ccw(a, b, c);if (ret > 0)cout << 1;else if (ret < 0)cout << -1;elsecout << 0;return 0;}'BOJ' 카테고리의 다른 글
[16929] Two Dots (0) 2022.02.11 [5397] 키로거 (0) 2022.02.11 [1035] 조각 움직이기 (0) 2022.02.10 [1167] 트리의 지름 (0) 2022.02.10 [1240] 노드사이의 거리 (0) 2022.02.09