8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 79d4483 commit e18c681Copy full SHA for e18c681
Appendix C/solutions/1497.cpp
@@ -1,6 +1,6 @@
1
// Authored by : BaaaaaaaaaaarkingDog
2
// Co-authored by : -
3
-// http://boj.kr/2532d97629b04d7c86f15db6bee08772
+// http://boj.kr/8b88c60fcf17452a9e602ef1bc17adde
4
#include <bits/stdc++.h>
5
using namespace std;
6
@@ -9,7 +9,7 @@ long long state[10];
9
10
int bit_cnt(long long x){
11
int ret = 0;
12
- for(int i = 0; i < m; i++){
+ for(int i = 0; i < max(n, m); i++){
13
ret += (x >> i) & 1;
14
}
15
return ret;
@@ -31,7 +31,7 @@ int main(){
31
pair<int, int> ans = {0, -1}; // {연주할 수 있는 곡의 수, 필요한 기타의 수}
32
for(int tmp = 0; tmp < (1 << n); tmp++){
33
long long comb = 0; // 조합한 결과
34
+ for(int i = 0; i < n; i++){
35
if((tmp & (1LL << i)) == 0)
36
continue;
37
comb |= state[i];
0 commit comments