BOJ 16764 : Cowpatibility

2021. 8. 13. 01:20PS/Data Structures

https://www.acmicpc.net/problem/16764

 

16764번: Cowpatibility

Here, cow 4 is not compatible with any of cows 1, 2, or 3, and cows 1 and 3 are also not compatible.

www.acmicpc.net

가능한 조합을 모두 맵에 저장해놓고  

포함 베제 원리를 이용하면 된다. 

(가능한 모든 조합 - 1개짜리 + 2개짜리 - 3개짜리 + 4개짜리 - 5개짜리)

자세한건 코드 참고.

'PS > Data Structures' 카테고리의 다른 글

BOJ 9935 : 문자열 폭발  (0) 2020.09.26