Skip to content
Open
Binary file modified .DS_Store
Binary file not shown.
70 changes: 0 additions & 70 deletions 15주차/(P)17679/(P)17679_Python_노유빈.py

This file was deleted.

13 changes: 13 additions & 0 deletions 15주차/2146/2146_python_노유빈.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 잘 모르겠다..



# 첫 줄에는 지도의 크기 N(100이하의 자연수)가 주어진다.
# 그 다음 N줄에는 N개의 숫자가 빈칸을 사이에 두고 주어지며, 0은 바다, 1은 육지를 나타낸다.
# 항상 두 개 이상의 섬이 있는 데이터만 입력으로 주어진다.


N = int(input())
map = input()

# 각 섬 별 숫자를 다르게 표기하기
62 changes: 62 additions & 0 deletions 16주차/(P)17677/(P)17677_python_노유빈.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
def solution(str1, str2):

answer = 0

# 알파벳 리스트
m = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

# 각 문자열 소문자로 변환 후 리스트에 담기
a = list(str1.lower())
b = list(str2.lower())

# 조건 만족하는 값들만 담을 리스트 생성
final_a = [ ]
final_b = [ ]

# a 에서 조건 만족 하는 값들만 final에 담기

for i in range(0,len(a)-1):
if a[i] in m and a[i+1] in m:
final_a.append(a[i]+a[i+1])

# b 에서 조건 만족 하는 값들만 final에 담기

for i in range(0,len(b)-1):
if b[i] in m and b[i+1] in m:
final_b.append(b[i]+b[i+1])

inter = [ ] # 교집합
outer = final_a+final_b # 합집합
outer = list(set(outer))

final_inter = [ ]
final_outer = [ ]



# 일반 교집합 구하기

for i in range(0,len(final_a)):
if final_a[i] in final_b:
inter.append(final_a[i])

# 일반 교집합 중복 제거

inter = list(set(inter))

# 자카드 교집합 구하기

for i in range(0,len(inter)):
for j in range(min(final_a.count(inter[i]),final_b.count(inter[i]))):
final_inter.append(inter[i])



for i in range(0,len(outer)):
for j in range(max(final_a.count(outer[i]),final_b.count(outer[i]))):
final_outer.append(outer[i])

if len(final_outer)==0:
return 65536

return int((len(final_inter)/len(final_outer))*65536)
83 changes: 83 additions & 0 deletions 16주차/(P)81302/(P)81302_python_노유빈.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
def solution(places):
answer = []

# 각 고사장 별 사람 위치 리스트

one = []
two = []
three = []
four = []
five = []
# 실패. 사람들 위치, 파티션 위치를 좌표로 구했지만 그 이후 방법을 모르겠음.


# 각 고사장 별 파티션 위치 리스트
one_p = []
two_p = []
three_p = []
four_p = []
five_p = []


# places[0] 의 사람, 파티션 좌표 구하기

a = places[0]

for i in range(0,5):
b = list(a[i])
for j in range(0,5):
if b[j]=='P':
one.append([i,j])
if b[j]=='X':
one_p.append([i,j])

# places[1] 의 사람, 파티션 좌표 구하기

c = places[0]

for i in range(0,5):
d = list(c[i])
for j in range(0,5):
if d[j]=='P':
two.append([i,j])
if d[j]=='X':
two_p.append([i,j])

# places[2] 의 사람, 파티션 좌표 구하기

e = places[0]

for i in range(0,5):
f = list(e[i])
for j in range(0,5):
if f[j]=='P':
three.append([i,j])
if f[j]=='X':
three_p.append([i,j])


# places[3] 의 사람, 파티션 좌표 구하기

g = places[0]

for i in range(0,5):
h = list(g[i])
for j in range(0,5):
if h[j]=='P':
four.append([i,j])
if h[j]=='X':
four_p.append([i,j])

# places[4] 의 사람, 파티션 좌표 구하기

q = places[0]

for i in range(0,5):
w = list(q[i])
for j in range(0,5):
if w[j]=='P':
five.append([i,j])
if w[j]=='X':
five_p.append([i,j])

return four_p
72 changes: 72 additions & 0 deletions 17주차/(P)60059/(P)60059_노유빈_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 좌표 별로 두가지의 기준으로 나누어서 거리를 계산하는 방식으로 했지만 실패했다.


import math

# 좌표 거리 계산 함수

def distance(key_loc):

key_dis_1 = []
for i in range(0,len(key_loc)-1):
for j in range(i+1,len(key_loc)):
key_dis_1.append((key_loc[i][0]-key_loc[j][0])**2+(key_loc[i][1]-key_loc[j][1])**2)

return key_dis_1


def solution(key, lock):
answer = True

# key : 1 , lock : 0 이 만나야 함

# key, lock 좌표 리스트

key_loc_1 = [ ]
lock_loc_1 = [ ]

key_loc_2 = [ ]
lock_loc_2 = [ ]




# key_loc 들에 대입

for i in range(0,len(key)):
for j in range(0,len(key[0])):
if key[i][j] == 1 and i>=j:
key_loc_1.append([i,j])
if key[i][j] == 1 and i<j:
key_loc_2.append([i,j])

# lock_loc 들에 대입

for i in range(0,len(lock)):
for j in range(0,len(lock[0])):
if lock[i][j] == 0 and i>=j:
lock_loc_1.append([i,j])
if lock[i][j] == 0 and i<j:
lock_loc_2.append([i,j])


# key, lock 좌표들의 거리 리스트

key_dis_1 = distance(key_loc_1)
lock_dis_1 = distance(lock_loc_1)

key_dis_2 = distance(key_loc_2)
lock_dis_2 = distance(lock_loc_2)



for i in lock_dis_1:
if i not in key_dis_1:
return False

for i in lock_dis_2:
if i not in key_dis_2:
return False


return True
72 changes: 72 additions & 0 deletions 17주차/(P)60059_노유빈_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 좌표 별로 두가지의 기준으로 나누어서 거리를 계산하는 방식으로 했지만 실패했다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15주차부터 17주차까지 한 PR에 다 올라왔네요! 이런..


import math

# 좌표 거리 계산 함수

def distance(key_loc):

key_dis_1 = []
for i in range(0,len(key_loc)-1):
for j in range(i+1,len(key_loc)):
key_dis_1.append((key_loc[i][0]-key_loc[j][0])**2+(key_loc[i][1]-key_loc[j][1])**2)

return key_dis_1


def solution(key, lock):
answer = True

# key : 1 , lock : 0 이 만나야 함

# key, lock 좌표 리스트

key_loc_1 = [ ]
lock_loc_1 = [ ]

key_loc_2 = [ ]
lock_loc_2 = [ ]




# key_loc 들에 대입

for i in range(0,len(key)):
for j in range(0,len(key[0])):
if key[i][j] == 1 and i>=j:
key_loc_1.append([i,j])
if key[i][j] == 1 and i<j:
key_loc_2.append([i,j])

# lock_loc 들에 대입

for i in range(0,len(lock)):
for j in range(0,len(lock[0])):
if lock[i][j] == 0 and i>=j:
lock_loc_1.append([i,j])
if lock[i][j] == 0 and i<j:
lock_loc_2.append([i,j])


# key, lock 좌표들의 거리 리스트

key_dis_1 = distance(key_loc_1)
lock_dis_1 = distance(lock_loc_1)

key_dis_2 = distance(key_loc_2)
lock_dis_2 = distance(lock_loc_2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

거리 리스트 체크 굿굿 👍




for i in lock_dis_1:
if i not in key_dis_1:
return False

for i in lock_dis_2:
if i not in key_dis_2:
return False


return True
Loading