From 6b481b4784d895d4574dae30be72cd8beb84bcfc Mon Sep 17 00:00:00 2001 From: SUMIN Date: Sat, 11 Apr 2026 11:57:39 +0900 Subject: [PATCH] =?UTF-8?q?Upload=20files=20to=20"=EB=B0=B1=EC=A4=80"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 백준/17387.Py | 26 ++++++++++++++++++++++++++ 백준/21568.py | Bin 0 -> 1024 bytes 백준/22864.Py | 24 ++++++++++++++++++++++++ 백준/25212.py | 24 ++++++++++++++++++++++++ 백준/28467.py | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 백준/17387.Py create mode 100644 백준/21568.py create mode 100644 백준/22864.Py create mode 100644 백준/25212.py create mode 100644 백준/28467.py diff --git a/백준/17387.Py b/백준/17387.Py new file mode 100644 index 0000000..227725d --- /dev/null +++ b/백준/17387.Py @@ -0,0 +1,26 @@ +import sys + +input = sys.stdin.readline + +x1, y1, x2, y2 = map(int, input().split()) +x3, y3, x4, y4 = map(int, input().split()) + +ccw_a_1 = (x1 * y3 + x3 *y4+ x4*y1)-(x3*y1+x4*y3+x1*y4) +ccw_a_2 = (x2*y3+x3*y4+x4*y2) - (x3*y2+x4*y3+x2*y4) + + ccw_a = ccw_a_1 * ccw_a_2 + + ccw_b_1 = (x3 * y1 + x1 *y2+ x2*y3)-(x1*y3+x2*y1+x3*y2) + ccw_b_2 = (x4 * y1 + x1 *y2+ x2*y4)-(x1*y4+x2*y1+x4*y2) + +ccw_b = ccw_b_1 * ccw_b_2 + +if(ccw_a==0 and ccw_b==0): + if min(x1, x2) <= max(x3, x4) and min(x3, x4) <= max(x1, x2) and min(y1, y2)<= max(y3, y4) and min(y3,y4) <= max(y1, y2): + print(1) + else: + print(0) +elif(ccw_a<=0 and ccw_b<=0): + print(1) +else: + print(0) \ No newline at end of file diff --git a/백준/21568.py b/백준/21568.py new file mode 100644 index 0000000000000000000000000000000000000000..06d7405020018ddf3cacee90fd4af10487da3d20 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 0 HcmV?d00001 diff --git a/백준/22864.Py b/백준/22864.Py new file mode 100644 index 0000000..b869d54 --- /dev/null +++ b/백준/22864.Py @@ -0,0 +1,24 @@ +import sys + +A, B, C, M = map(int, input().split(' ')) + +tired = 0 +work = 0 + +def promising(i): + if(tired+A>M): + return False + else: + return True + + +for i in range(24): + if(promising(i)): + work += B + tired += A + else: + tired-=C + if(tired<0): + tired=0 + +print(work) diff --git a/백준/25212.py b/백준/25212.py new file mode 100644 index 0000000..a88c737 --- /dev/null +++ b/백준/25212.py @@ -0,0 +1,24 @@ +import sys +from itertools import combinations + +input = sys.stdin.readline + +n = int(input()) +arr = list(map(int, input().split())) +total = 0 + +translate_arr = [0] * n + +for i in range(n): + translate_arr[i] = 1 / arr[i] + +for i in range(1, n+1): + for j in combinations(translate_arr, i): + print(j) + + k = sum(j) + if(k>=0.99 and k<=1.01): + total+=1 + +print(total) + diff --git a/백준/28467.py b/백준/28467.py new file mode 100644 index 0000000..0a2105e --- /dev/null +++ b/백준/28467.py @@ -0,0 +1,34 @@ +#뭔가 Linkedlist 형태면 더 쉽게 문제 풀이도 가능할 것 같은데 아쉽네 + +import sys + +input = sys.stdin.readline + +n = int(input()) +arr = list(map(int, input().split())) +diff = [0 for _ in range(401)] +total_mana = 0 +check=False +if(len(arr)<=1): + check=True + +while(len(arr)>2): + diff_num = sys.maxsize + for i in range(len(arr)-1): + diff[i] = abs(arr[i+1] - arr[i]) + if(diff[i] < diff_num): + diff_num = diff[i] + min_index = i + total_mana+=arr[min_index]+arr[min_index+1] + max_value = max(arr[min_index], arr[min_index+1]) + arr[min_index+1] = max_value + del arr[min_index] + + +if(check): + print(0) +else: + print(total_mana+sum(arr)) + + +