Created
March 13, 2020 11:02
-
-
Save junhoyeo/f3d25cfedf9b32b8fba55edc34a3a5ed to your computer and use it in GitHub Desktop.
1부터 10까지의 자연수가 각각 하나씩 적힌 구술 10개 중 4개를 선택할 때 3의 배수가 적힌 구슬이 적어도 한 개 선택되는 경우의 수
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
| from itertools import combinations | |
| marbles = list(range(1, 11)) | |
| combs = list(combinations(marbles, 4)) | |
| result = 0 | |
| for comb in combs: | |
| if any(item % 3 == 0 for item in comb): | |
| result += 1 | |
| print(result) | |
| # 175 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment