baekjoon 20250318

This commit is contained in:
songyc macbook 2026-03-18 21:59:42 +09:00
parent 4ca3db136a
commit ea26cd983f
2 changed files with 47 additions and 0 deletions

View 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)

View 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)