-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3차/류동준 #22
Open
rdj94
wants to merge
3
commits into
master
Choose a base branch
from
3차/류동준
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "3\uCC28/\uB958\uB3D9\uC900"
Open
3차/류동준 #22
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
def caldist(l_hand,r_hand, num,position,hand): | ||
dist_l = abs(position[num][0] - position[l_hand][0]) + abs(position[num][1] - position[l_hand][1]) | ||
dist_r = abs(position[num][0] - position[r_hand][0]) + abs(position[num][1] - position[r_hand][1]) | ||
if dist_l == dist_r: | ||
return 'R' if hand =='right' else 'L' | ||
return 'R' if dist_l > dist_r else 'L' | ||
|
||
def solution(numbers, hand): | ||
position = { | ||
1: (0,0), 2: (0,1) ,3 :(0,2), | ||
4: (1,0), 5: (1,1) ,6 :(1,2), | ||
7: (2,0), 8: (2,1) ,9 : (2,2), | ||
'*':(3,0), 0:(3,1),'#': (3,2) | ||
} | ||
|
||
left_numbers,right_numbers = set([1,4,7,'*']),set([3,6,9,'#']) | ||
answer = '' | ||
l_hand = '*' | ||
r_hand = '#' | ||
|
||
for num in numbers: | ||
if num in left_numbers: | ||
answer += 'L' | ||
l_hand = num | ||
elif num in right_numbers: | ||
answer += 'R' | ||
r_hand = num | ||
else: | ||
result = caldist(l_hand,r_hand,num,position,hand) | ||
if result == 'R': | ||
r_hand = num | ||
else: | ||
l_hand = num | ||
answer += result | ||
|
||
return answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def solution(d, budget): | ||
answer = 0 | ||
# d가 가장 작은 값을 순서대로 가지게 끔 함 | ||
# 혹은 d의 value를 pop 할때 d.pop(d.index(min(d))) 도 가능하기는함. | ||
d.sort() | ||
while (budget): | ||
# 모든 d 를 pop 하고 budget이 여유있을때도 있음 test case를 통해 확인함. | ||
if d: | ||
min_value = d.pop(0) | ||
if min_value <= budget: | ||
budget -= min_value | ||
answer += 1 | ||
else: | ||
break | ||
else: | ||
break | ||
return answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def gcd(a,b): | ||
mod = a % b; | ||
while(mod > 0): | ||
a = b | ||
b = mod | ||
mod = a % b | ||
return b | ||
|
||
|
||
def solution(n, m): | ||
value = gcd(n,m) | ||
return [value, n *m / value] | ||
Comment on lines
+1
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이거 주말에 설명 부탁드립니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def solution(num): | ||
answer = 0 | ||
while(num!=1): | ||
if answer > 500: | ||
answer = -1 | ||
break | ||
if num % 2 == 0: | ||
num = num / 2 | ||
else: | ||
num = (num * 3) + 1 | ||
answer += 1 | ||
|
||
return answer |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# import numpy as np | ||
def solution(arr1, arr2): | ||
for i in range(len(arr1)): | ||
for j in range(len(arr1[i])): | ||
arr1[i][j] += arr2[i][j] | ||
return arr1 | ||
# return np.add(np.asarray(arr1),np.asarray(arr2)).tolist() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python의 멋진 기능