diff --git a/.DS_Store b/.DS_Store index df33823..ab1d8ce 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git "a/15\354\243\274\354\260\250/(P)17679/(P)17679_Python_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253.py" "b/15\354\243\274\354\260\250/(P)17679/(P)17679_Python_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253.py" deleted file mode 100644 index cb80d1c..0000000 --- "a/15\354\243\274\354\260\250/(P)17679/(P)17679_Python_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253.py" +++ /dev/null @@ -1,70 +0,0 @@ -# 나머지 테스트 코드는 통과했지만 테스트 코드 10번 정확성 실패, 테스트 코드 2번 효율성 실패이다. - - - - -# 제거되는 블럭들을 '0' 으로 치환 후 제거한 후 값이 '0'인 블럭 위의 블럭이 대치 후 list 리턴 해주기. 제거되는 블럭이 없다면 false 리턴. - -def remove(a): - list = [] - - # 제거될 블럭 중 가장 왼쪽위 의 블럭의 좌표를 list 에 담기. - for i in range(0,len(a)-1): - for j in range(0,len(a[0])-1): - if a[i][j]==a[i+1][j] and a[i][j]==a[i][j+1] and a[i][j]==a[i+1][j+1]: - list.append([i,j]) - - - # list 가 비었으면 false 리턴 - if len(list)==0: - return False - - else: - # 비었지 않다면 그 블럭 포함 4개의 블럭 값을 '0' 으로 치환. - for i in range(0,len(list)): - a[list[i][0]][list[i][1]]='0' - a[list[i][0]+1][list[i][1]]='0' - a[list[i][0]][list[i][1]+1]='0' - a[list[i][0]+1][list[i][1]+1]='0' - - # 아래 블럭의 값이 '0' 이라면 자신의 값을 '0' 으로 바꾸고 아래 블럭 값을 자신의 블럭 값으로 바꾸기. - for i in range(0,len(a)-1): - for j in range(0,len(a[0])): - if a[i+1][j] == '0': - a[i+1][j] = a[i][j] - a[i][j] = '0' - - # 변경된 리스트 리턴 - return a - - - - -def solution(m, n, board): - - # m:높이, n:폭 - - answer = 0 - a = [ ] - - str = [ ] - - # board를 문자를 기준으로 나누고 리스트에 저장 - - for i in range(0,len(board)): - for j in range(0,len(board[i])): - str.append(board[i][j]) - a.append(str) - str = [] - - # compare 함수에서 false 조건이 잘 나오지 않아 반복문으로 돌림 - for i in range(0,m*n): - a=remove(a) - - - # 값이 '0' 인 블럭이 제거된 블럭이기에 그 수를 셈. - for i in range(0,len(a)): - answer += a[i].count('0') - - - return answer diff --git "a/15\354\243\274\354\260\250/2146/(P)72412_python_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253.py" "b/15\354\243\274\354\260\250/(P)72412/(P)72412_python_\353\205\270\354\234\240\353\271\210.py" similarity index 100% rename from "15\354\243\274\354\260\250/2146/(P)72412_python_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253.py" rename to "15\354\243\274\354\260\250/(P)72412/(P)72412_python_\353\205\270\354\234\240\353\271\210.py" diff --git "a/15\354\243\274\354\260\250/2146/2146_python_\353\205\270\354\234\240\353\271\210.py" "b/15\354\243\274\354\260\250/2146/2146_python_\353\205\270\354\234\240\353\271\210.py" new file mode 100644 index 0000000..ebefbe6 --- /dev/null +++ "b/15\354\243\274\354\260\250/2146/2146_python_\353\205\270\354\234\240\353\271\210.py" @@ -0,0 +1,13 @@ +# 잘 모르겠다.. + + + +# 첫 줄에는 지도의 크기 N(100이하의 자연수)가 주어진다. +# 그 다음 N줄에는 N개의 숫자가 빈칸을 사이에 두고 주어지며, 0은 바다, 1은 육지를 나타낸다. +# 항상 두 개 이상의 섬이 있는 데이터만 입력으로 주어진다. + + +N = int(input()) +map = input() + +# 각 섬 별 숫자를 다르게 표기하기 \ No newline at end of file diff --git "a/16\354\243\274\354\260\250/(P)17677/(P)17677_python_\353\205\270\354\234\240\353\271\210.py" "b/16\354\243\274\354\260\250/(P)17677/(P)17677_python_\353\205\270\354\234\240\353\271\210.py" new file mode 100644 index 0000000..d7a5b2c --- /dev/null +++ "b/16\354\243\274\354\260\250/(P)17677/(P)17677_python_\353\205\270\354\234\240\353\271\210.py" @@ -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) \ No newline at end of file diff --git "a/16\354\243\274\354\260\250/(P)81302/(P)81302_python_\353\205\270\354\234\240\353\271\210.py" "b/16\354\243\274\354\260\250/(P)81302/(P)81302_python_\353\205\270\354\234\240\353\271\210.py" new file mode 100644 index 0000000..dce26b1 --- /dev/null +++ "b/16\354\243\274\354\260\250/(P)81302/(P)81302_python_\353\205\270\354\234\240\353\271\210.py" @@ -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 \ No newline at end of file diff --git "a/17\354\243\274\354\260\250/(P)60059/(P)60059_\353\205\270\354\234\240\353\271\210_python.py" "b/17\354\243\274\354\260\250/(P)60059/(P)60059_\353\205\270\354\234\240\353\271\210_python.py" new file mode 100644 index 0000000..147c569 --- /dev/null +++ "b/17\354\243\274\354\260\250/(P)60059/(P)60059_\353\205\270\354\234\240\353\271\210_python.py" @@ -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: + lock_loc_1.append([i,j]) + if lock[i][j] == 0 and i=j: + key_loc_1.append([i,j]) + if key[i][j] == 1 and i=j: + lock_loc_1.append([i,j]) + if lock[i][j] == 0 and i0: + list[i] = list[i]-1 + + return list + +# 리스트가 한번 회전하는 함수 + +def rotate(list): + + list[0]=list[-1] + + for i in range(1,len(list)): + list[i] = list[i-1] + + return list + + + +while True: + if b.count(0) >= a[1]: + break + else: + b=delete(b) + b=rotate(b) + answer+=1 + + + +print(answer) \ No newline at end of file diff --git "a/17\354\243\274\354\260\250/20055_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253_python.py" "b/17\354\243\274\354\260\250/20055_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253_python.py" new file mode 100644 index 0000000..2e4be1c --- /dev/null +++ "b/17\354\243\274\354\260\250/20055_\341\204\202\341\205\251\341\204\213\341\205\262\341\204\207\341\205\265\341\206\253_python.py" @@ -0,0 +1,40 @@ +# 왜 계속 무한루프인지 모르겠네요.. 문제 이해를 잘못한것 같기도 합니다. + +a = list(map(int, input().split(" "))) # 길이, K input +b = list(map(int, input().split(" "))) # 내구도 input + +answer = 1 + +# 내구도 1 이상인 것들 1씩 제거 해주는 함수 + +def delete(list): + for i in range(0,int(len(list)/2)): + if list[i]>0: + list[i] = list[i]-1 + + return list + +# 리스트가 한번 회전하는 함수 + +def rotate(list): + + list[0]=list[-1] + + for i in range(1,len(list)): + list[i] = list[i-1] + + return list + + + +while True: + if b.count(0) >= a[1]: + break + else: + b=delete(b) + b=rotate(b) + answer+=1 + + + +print(answer) \ No newline at end of file