baekjoon 20260316
This commit is contained in:
parent
4ca3db136a
commit
cf22c464a3
40
code_study/Baekjoon/python/17387.py
Normal file
40
code_study/Baekjoon/python/17387.py
Normal file
@ -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)
|
||||||
7
code_study/Baekjoon/python/2875.py
Normal file
7
code_study/Baekjoon/python/2875.py
Normal file
@ -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)
|
||||||
Loading…
x
Reference in New Issue
Block a user