Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
입력 처리: 비밀번호의 자릿수 n, 기억하고 있는 정보의 수 m, 비밀번호 입력 시간 x, 그리고 비밀번호 입력에 실패한 후 대기하는 시간 y를 입력받습니다.
정보 처리: 비밀번호에 대한 정보를 입력받아, 비밀번호의 특정 자리가 확정된 경우와 비밀번호 중 하나의 숫자가 확정된 경우를 구분합니다. pwCnt는 비밀번호의 특정 자리가 확정된 숫자의 개수를 나타내고, cnt는 비밀번호에 포함되어야 하는 확정된 숫자의 개수입니다.
비밀번호 조합 계산:
math.factorial(x):
x의 팩토리얼을 계산합니다. 팩토리얼은 1부터 x까지의 모든 정수의 곱을 의미합니다. 예를 들어, 5! (5의 팩토리얼)은 5 * 4 * 3 * 2 * 1 = 120입니다.
예) math.factorial(5)는 120을 반환합니다.
math.comb(n, k):
n개의 다른 항목들 중에서 k개를 선택하는 방법의 수, 즉 조합의 수를 계산합니다. 조합은 순서를 고려하지 않습니다.
예를 들어, {A, B, C}에서 2개를 선택하는 방법은 {A, B}, {A, C}, {B, C}의 3가지입니다.
예) math.comb(3, 2)는 3을 반환합니다.
math.perm(n, k=None):
n개의 다른 항목들 중에서 k개를 선택하여 나열하는 방법의 수, 즉 순열의 수를 계산합니다.
k가 지정되지 않으면 n으로 간주되어 n개 모두를 나열하는 순열의 수를 계산합니다.
순열은 선택된 항목들의 순서를 고려합니다. 예를 들어, {A, B}에서 2개를 나열하는 방법은 (A, B)와 (B, A)의 2가지입니다.
예) math.perm(2)는 2를 반환하고, math.perm(3, 2)는 6을 반환합니다.