티스토리 뷰
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
백준 소스코드 [C++] 11758 CCW
#include <iostream>
#include <algorithm>
#include <queue>
#include <string.h>
#include <limits.h>
#include <vector>
#include <math.h>
#include <stack>
#include <bitset>
#include <string>
typedef long long ll;
using namespace std;
struct dot {
ll x, y;
};
vector<dot> dots;
int ccw(dot A, dot B, dot C) {
ll rot = (B.x - A.x) * (C.y - A.y) - (C.x - A.x) * (B.y - A.y);
if (rot > 0) return 1;
else if (rot < 0) return -1;
else return 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
dots.resize(3);
for (int i = 0;i < 3;i++) cin >> dots[i].x >> dots[i].y;
cout << ccw(dots[0], dots[1], dots[2]);
return 0;
}
'백준' 카테고리의 다른 글
백준 소스코드 [C++] 10999 구간 합 구하기 2 (0) | 2020.11.12 |
---|---|
백준 소스코드 [C++] 18436 수열과 쿼리 37 (0) | 2020.11.11 |
백준 소스코드 [C++] 1275 커피숍 2 (0) | 2020.11.11 |
백준 소스코드 [C++] 2268 수들의 합 (0) | 2020.11.11 |
백준 소스코드 [C++] 5676 음주 코딩 (0) | 2020.11.10 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- test coverage
- 컴퓨터 추상화
- mach-o
- 네트워크 유량
- IOS
- 벨만포드 시간복잡도
- CPU와 Memory
- 네트워크 플로우
- WWDC21
- CompositionalLayout
- WWDC17
- HIG
- State Restoration
- 다익스트라 시간복잡도
- WWDC16
- observeOn
- MeTal
- 코딩대회
- WWDC19
- 최단경로 알고리즘
- 부스트캠프 6기
- Testable
- rxswift
- 최단경로문제
- 벨만포드 알고리즘
- 포드 풀커슨 알고리즘
- 최대 매칭
- 강한 순환 참조
- 최단경로 문제
- 에드몬드 카프 알고리즘
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함