diff --git a/백준/0209_01.py b/백준/0209_01.py new file mode 100644 index 0000000..b8f4416 --- /dev/null +++ b/백준/0209_01.py @@ -0,0 +1,24 @@ +from collections import deque + +queue = deque +queue.popleft() +def solution(clothes): + arr=[] + temp=2 + answer = 1 + clothes.sort(key = lambda x:(x[1], x[0])) + maxvalue = len(clothes) + for i in range(0, maxvalue-1): + if (clothes[i][1] != clothes[i+1][1]): + arr.append(temp) + temp=2 + else: + temp+=1 + arr.append(temp) + for j in arr: + answer *= j + answer -= 1 + queue + return answer + +print(solution([["yellow_hat", "headgear"], ["blue_sunglasses", "eyewear"], ["green_turban", "headgear"]])) \ No newline at end of file diff --git a/백준/0209_01_01.py b/백준/0209_01_01.py new file mode 100644 index 0000000..3486c52 --- /dev/null +++ b/백준/0209_01_01.py @@ -0,0 +1,28 @@ +from collections import deque + +def solution(bridge_length, weight, truck_weights): + queue = deque() + index = 0 + seconds = 0 + maxvalue=len(truck_weights)-1 + now_weight=0 + for _ in range(bridge_length): + queue.append(0) + while True: + seconds+=1 + now_weight-=queue.popleft() + if(now_weight+truck_weights[index] <= weight): + queue.append(truck_weights[index]) + now_weight+=truck_weights[index] + if(index==maxvalue): + seconds+=bridge_length + break + else: + index+=1 + else: + queue.append(0) + if(now_weight == 0): + break + return seconds + +print(solution(2, 10, [7,4,5,6])) \ No newline at end of file diff --git a/백준/1016.Py b/백준/1016.Py new file mode 100644 index 0000000..6b17fbb --- /dev/null +++ b/백준/1016.Py @@ -0,0 +1,23 @@ + import math + import sys + + input = sys.stdin.readline + + min, max = map(int, input().split()) + + arr = [False] * (max-min+1) + + for i in range(2, int(math.sqrt(max)+1)): + pow = i * i + start_index = int(min / pow) # 제곱수가 아닌 수 -> 제곱수는 무언가를 곱해서 만드는 수 ? 인걸로 이해했는데 + if min % pow!=0: + start_index += 1 + for j in range(start_index, int(max/pow)+1): + arr[int((j*pow) - min)] = True + + count = 0 + for i in range(0, max-min+1): + if arr[i] == False: + count += 1 + + print(count) diff --git a/백준/222.cc b/백준/222.cc new file mode 100644 index 0000000..06d7405 Binary files /dev/null and b/백준/222.cc differ diff --git a/백준/223.cc b/백준/223.cc new file mode 100644 index 0000000..06d7405 Binary files /dev/null and b/백준/223.cc differ