-
Notifications
You must be signed in to change notification settings - Fork 6
[CR] 10월 3주차 #102
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
Open
s0n9h2
wants to merge
5
commits into
elice-02-study-01-algorithm:main
Choose a base branch
from
s0n9h2:main
base: main
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.
Open
[CR] 10월 3주차 #102
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e275b3a
[Line] 2, 3번 시도
s0n9h2 8be0420
[baekjoon-9375] 패션왕 신해빈
s0n9h2 834c384
[baekjoon-1107] 리모컨
s0n9h2 9ed563e
Merge branch 'main' of https://github.com/s0n9h2/Python-Coding-Test-S…
s0n9h2 ed1d4e0
Merge branch 'elice-02-study-01-algorithm:main' into main
s0n9h2 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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,37 @@ | ||
| # https://www.acmicpc.net/board/view/73355 | ||
| from itertools import product | ||
| from sys import stdin | ||
| input = stdin.readline | ||
|
|
||
| # 현재 100번에서 시작 | ||
| # 먼저 제일 가까운 숫자를 찾아야 함 | ||
| def main(): | ||
| channel_num = int(input()) | ||
| broken = int(input()) | ||
| length = len(str(channel_num)) | ||
| if broken == 0: | ||
| print(min(length, abs(channel_num - 100))) | ||
| else: | ||
| # 일단 answer에 100번과의 차이를 저장 | ||
| answer = abs(channel_num - 100) if channel_num != 100 else 0 | ||
|
|
||
| broken_nums = set(input().split()) | ||
| nums = set(["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]) | ||
| normal_nums = nums - broken_nums | ||
|
|
||
| # 가능한 조합 중 원하는 채널보다 하나 작은 개수, 같은 개수, 하나 많은 개수의 길이인 경우 구하기 | ||
| possible_nums = [] | ||
| if length == 1: | ||
| for x in range(length, length + 2): | ||
| possible_nums.extend(product(normal_nums, repeat = x)) | ||
| else: | ||
| for x in range(length - 1, length + 2): | ||
| possible_nums.extend(product(normal_nums, repeat = x)) | ||
|
|
||
| for y in possible_nums: | ||
| num = int("".join(y)) | ||
| if abs(channel_num - num) + len(y) < answer: | ||
| answer = abs(channel_num - num) + len(y) | ||
| print(answer) | ||
|
|
||
| main() | ||
|
Contributor
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 hidden or 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,19 @@ | ||
| from sys import stdin | ||
| input = stdin.readline | ||
|
|
||
| T = int(input()) | ||
| for _ in range(T): | ||
| clothes = int(input()) | ||
| cloth_dict = {} | ||
| for _ in range(clothes): | ||
| cloth, type = input().split() | ||
| if type in cloth_dict: | ||
| cloth_dict[type] += 1 | ||
| else: | ||
| cloth_dict[type] = 1 | ||
| # 해당 종류를 입을지 안입을지 모든 경우의 수 곱하기 | ||
| answer = 1 | ||
| for type in cloth_dict: | ||
| answer *= cloth_dict[type] + 1 | ||
| # 알몸이 되는 경우 빼기 | ||
| print(answer - 1) | ||
|
Contributor
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. 풀이가 동일해요! 그래서 술술 읽혔습니다. |
||
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.
extend 신기하네요..! 파이썬 대단해..