-
백준 18429코테 대비 python/백준 2022. 4. 24. 23:38
https://www.acmicpc.net/problem/18429
18429번: 근손실
웨이트 트레이닝을 좋아하는 어떤 대학원생은, 현재 3대 운동 중량 500의 괴력을 소유하고 있다. 다만, 하루가 지날 때마다 중량이 K만큼 감소한다. 예를 들어 K=4일 때, 3일이 지나면 중량이 488로
www.acmicpc.net
#모든 경우의수 해보고 아닌거 거르기 import itertools N, K = map(int,input().split()) A = list(map(int,input().split())) count=0 for weight in itertools.permutations(A,N): W = 500 for w in weight: W+=w-K if W <500: break else: count+=1 print(count)
배운것1. itertools permutations => 순열
'코테 대비 python > 백준' 카테고리의 다른 글
이코테 문자열 재정렬 (0) 2022.08.02 백준 18406 (0) 2022.07.29 백준 16208 (0) 2022.04.21 백준 16171 (0) 2022.04.19 백준 14912 (2) 2022.04.16