diff --git a/argorithm/.idea/.gitignore b/argorithm/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/argorithm/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/argorithm/.idea/argorithm.iml b/argorithm/.idea/argorithm.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/argorithm/.idea/argorithm.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/argorithm/.idea/inspectionProfiles/profiles_settings.xml b/argorithm/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/argorithm/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/argorithm/.idea/misc.xml b/argorithm/.idea/misc.xml new file mode 100644 index 0000000..d1e22ec --- /dev/null +++ b/argorithm/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/argorithm/.idea/modules.xml b/argorithm/.idea/modules.xml new file mode 100644 index 0000000..0aa91b5 --- /dev/null +++ b/argorithm/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/argorithm/.idea/vcs.xml b/argorithm/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/argorithm/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/argorithm/best_albumn.py b/argorithm/best_albumn.py new file mode 100644 index 0000000..f4d6185 --- /dev/null +++ b/argorithm/best_albumn.py @@ -0,0 +1,25 @@ +global cnt +cnt = 0 + +# 주어진 배열, 현재 인덱스, target, now_value +def dfs(numbers, start_idx, target, now_value): + global cnt + if start_idx == len(numbers): + if now_value == target: + cnt += 1 + else: + print('+',numbers[start_idx]) + dfs(numbers, start_idx+1, target, now_value+numbers[start_idx]) + + print('-',numbers[start_idx]) + dfs(numbers, start_idx+1, target, now_value-numbers[start_idx]) + return cnt + +def solution(numbers, target): + answer = dfs(numbers, 0, target, 0) + return answer +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + numbers = [1, 1, 1, 1, 1] + target = 3 + solution(numbers,target) diff --git a/argorithm/carpet.py b/argorithm/carpet.py new file mode 100644 index 0000000..54f47a9 --- /dev/null +++ b/argorithm/carpet.py @@ -0,0 +1,32 @@ +from numpy import median + + +def solution(brown, yellow): + s_answer = [] + # yellow의 약수 구하기 + yak_list = [int(i) for i in range(1, yellow+1) if yellow % i == 0] + if len(yak_list) % 2 == 0: + while len(yak_list): + x = yak_list.pop() + y = yak_list.pop(0) + if (x+2)*(y+2)-(x*y) == brown: + s_answer.append(int(x+2)) + s_answer.append(int(y+2)) + return s_answer + else: + while len(yak_list): + if len(yak_list) == 1: + x = median(yak_list) + y = x + else: + x = yak_list.pop() + y = yak_list.pop(0) + if (x+2)*(y+2)-(x*y) == brown: + s_answer.append(int(x+2)) + s_answer.append(int(y+2)) + return s_answer + + +if __name__ == '__main__': + answer = solution(8, 1) + print('출력값: ', answer) diff --git a/argorithm/main.py b/argorithm/main.py new file mode 100644 index 0000000..5596b44 --- /dev/null +++ b/argorithm/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/markdown/README.md b/markdown/README.md new file mode 100644 index 0000000..c97b45a --- /dev/null +++ b/markdown/README.md @@ -0,0 +1,2 @@ +# 깃허브 1일 1커밋 시작! +