From cf22c464a3aa6cbcc1c3be07945e50ca10f3025e Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Wed, 18 Mar 2026 21:59:42 +0900 Subject: [PATCH] baekjoon 20260316 --- code_study/Baekjoon/python/17387.py | 40 +++++++++++++++++++++++++++++ code_study/Baekjoon/python/2875.py | 7 +++++ 2 files changed, 47 insertions(+) create mode 100644 code_study/Baekjoon/python/17387.py create mode 100644 code_study/Baekjoon/python/2875.py diff --git a/code_study/Baekjoon/python/17387.py b/code_study/Baekjoon/python/17387.py new file mode 100644 index 0000000..3b64f82 --- /dev/null +++ b/code_study/Baekjoon/python/17387.py @@ -0,0 +1,40 @@ +def compare(A, B) : + if A[0] < B[0] : + return True + elif A[0] == B[0] : + return A[1] <= B[1] + else : + return False + +def crossProduct(A, B, C) : + crossValue = (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1]) * (C[0] - A[0]) + if crossValue > 0 : + return 1 + elif crossValue < 0 : + return -1 + else : + return 0 + +x1, y1, x2, y2 = map(int, input().split()) +x3, y3, x4, y4 = map(int, input().split()) + +A, B, C, D = [x1, y1], [x2, y2], [x3, y3], [x4, y4] +if not compare(A, B) : + A, B = B, A + +if not compare(C, D) : + C, D = D, C + +crossABCD = crossProduct(A, B, C) * crossProduct(A, B, D) +crossCDAB = crossProduct(C, D, A) * crossProduct(C, D, B) + +ans = 0 + +if crossABCD == 0 and crossCDAB == 0 : + if compare(A, D) and compare(C, B) : + ans = 1 + +elif crossABCD <= 0 and crossCDAB <= 0 : + ans = 1 + +print(ans) \ No newline at end of file diff --git a/code_study/Baekjoon/python/2875.py b/code_study/Baekjoon/python/2875.py new file mode 100644 index 0000000..a26da91 --- /dev/null +++ b/code_study/Baekjoon/python/2875.py @@ -0,0 +1,7 @@ +n, m, k = map(int, input().split()) +ans = 0 + +while n >= 2 and m >= 1 and (n+m) >= k + 3 : + n, m , ans = n-2, m-1, ans+1 + +print(ans) \ No newline at end of file