Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- hackerrank
- ChatGPT
- Kaggle
- dacon
- 자연어처리
- 편스토랑 우승상품
- 맥북
- 파이썬
- Git
- Docker
- 우분투
- leetcode
- 금융문자분석경진대회
- programmers
- 캐치카페
- 더현대서울 맛집
- Real or Not? NLP with Disaster Tweets
- 프로그래머스 파이썬
- SW Expert Academy
- 편스토랑
- github
- 백준
- gs25
- Baekjoon
- PYTHON
- 데이콘
- AI 경진대회
- ubuntu
- 프로그래머스
- 코로나19
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 11758번 : CCW (Python) 본문
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 CCW 입니다.
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
Solution
def convert_input_to_point(string):
point_x, point_y = map(int, string.split())
return {"x": point_x, "y": point_y}
def CCW(point1, point2, point3):
answer = 0
y = (point2['x'] - point1['x']) * (point3['y'] - point1['y'])
y3 = (point2['y'] - point1['y']) * (point3['x'] - point1['x'])
if y > y3:
answer = 1
elif y < y3:
answer = -1
return answer
if __name__ == "__main__":
point1 = convert_input_to_point(input())
point2 = convert_input_to_point(input())
point3 = convert_input_to_point(input())
print(CCW(point1, point2, point3))
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 1931번 : 회의실 배정 (Python) (0) | 2021.08.27 |
---|---|
[BaekJoon] 10823번 : 더하기 2 (Python) (0) | 2021.08.26 |
[Programmers] 위클리 챌린지 4주차 - 직업군 추천하기 (Python) (0) | 2021.08.23 |
[BaekJoon] 2755번 : 이번학기 평점은 몇점? (Python) (0) | 2021.08.22 |
[BaekJoon] 14915번 : 진수 변환기 (Python) (0) | 2021.08.21 |