Upload files to "백준"
This commit is contained in:
26
백준/17387.Py
Normal file
26
백준/17387.Py
Normal file
@@ -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)
|
||||||
BIN
백준/21568.py
Normal file
BIN
백준/21568.py
Normal file
Binary file not shown.
24
백준/22864.Py
Normal file
24
백준/22864.Py
Normal file
@@ -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)
|
||||||
24
백준/25212.py
Normal file
24
백준/25212.py
Normal file
@@ -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)
|
||||||
|
|
||||||
34
백준/28467.py
Normal file
34
백준/28467.py
Normal file
@@ -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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user