From 79d44830a6772ca8d550bf096e46cbab50b1ba6e Mon Sep 17 00:00:00 2001 From: encrypted-def <20028331+encrypted-def@users.noreply.github.com> Date: Wed, 24 Apr 2024 22:55:34 +0900 Subject: [PATCH] Update 1497.cpp --- Appendix C/1497.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Appendix C/1497.cpp b/Appendix C/1497.cpp index da19834d..ad42ca07 100644 --- a/Appendix C/1497.cpp +++ b/Appendix C/1497.cpp @@ -1,4 +1,4 @@ -// http://boj.kr/2532d97629b04d7c86f15db6bee08772 +// http://boj.kr/8b88c60fcf17452a9e602ef1bc17adde #include using namespace std; @@ -7,7 +7,7 @@ long long state[10]; int bit_cnt(long long x){ int ret = 0; - for(int i = 0; i < m; i++){ + for(int i = 0; i < max(n, m); i++){ ret += (x >> i) & 1; } return ret; @@ -29,7 +29,7 @@ int main(){ pair ans = {0, -1}; // {연주할 수 있는 곡의 수, 필요한 기타의 수} for(int tmp = 0; tmp < (1 << n); tmp++){ long long comb = 0; // 조합한 결과 - for(int i = 0; i < m; i++){ + for(int i = 0; i < n; i++){ if((tmp & (1LL << i)) == 0) continue; comb |= state[i];