https://www.acmicpc.net/problem/24267
1
2
3
4
5
6
7
8
9
10
11
|
from math import factorial
if __name__ == '__main__':
cnt = 0
n = int(input())
if n>=3:
print(int(factorial(n)/(factorial(n-3)*factorial(3))))
else:
print(0)
print(3)
|
cs |
반복문 해석하면 n개중에 3개뽑는것과 같죠(== n combination 3)
그리고 3중반복문 이므로 3도 출력합니다.
If you interpret the loop statement, it is the same as picking 3 out of n (== n combination 3)
And since it is a triple repetition statement, 3 is also output.
반응형
'python-algorithm' 카테고리의 다른 글
백준 16861 Harshad Numbers (0) | 2023.01.03 |
---|---|
백준 23343 JavaScript (0) | 2023.01.03 |
백준 11328 Strfry (0) | 2023.01.02 |
백준 3512 Flat (0) | 2022.12.31 |
백준 26264 빅데이터? 정보보호! (0) | 2022.12.30 |
댓글