https://www.acmicpc.net/problem/6768
6768번: Don’t pass me the ball!
A CCC soccer game operates under slightly different soccer rules. A goal is only counted if the 4 players, in order, who touched the ball prior to the goal have jersey numbers that are in strictly increasing numeric order with the highest number being the
www.acmicpc.net
문제
A CCC soccer game operates under slightly different soccer rules. A goal is only counted if the 4 players, in order, who touched the ball prior to the goal have jersey numbers that are in strictly increasing numeric order with the highest number being the goal scorer.
Players have jerseys numbered from 1 to 99 (and each jersey number is worn by exactly one player).
Given a jersey number of the goal scorer, indicate how many possible combinations of players can produce a valid goal.
입력
The input will be the positive integer J (1 ≤ J ≤ 99), which is the jersey number of the goal scorer.
출력
The output will be one line containing the number of possible scoring combinations that could have J as the goal scoring jersey number.
예제 입력 1
4
예제 출력 1
1
예제 입력 2
2
예제 출력 2
0
예제 입력 3
90
예제 출력 3
113564
# 1~99번까지의 선수 중 4명이 공을 터치하고, 마지막으로 터치한 사람이 골을 넣었다. # 공을 터치한 순서대로 선수들의 번호가 증가수열이어야 골로 인정해준다. # 입력으로 마지막 선수의 번호가 주어질 때, # 가능한 경우의 수를 출력한다. # 입력 J가 주어졌을 때, (J-1)C3 을 구하면 된다. J = int(input()) ans = (J-1) * (J-2) * (J-3) // 6 print(ans)
'Problem Solving > BOJ' 카테고리의 다른 글
[백준, BOJ 6810] ISBN (python) (0) | 2021.12.18 |
---|---|
[백준, BOJ 6778] Which Alien? (python) (0) | 2021.12.18 |
[백준, BOJ 11866] 요세푸스 문제 0 (python) (0) | 2021.12.17 |
[백준, BOJ 6764] Sounds fishy! (python) (0) | 2021.12.16 |
[백준, BOJ 6763] Speed fines are not fine! (python) (0) | 2021.12.16 |