10000
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 2891705 commit 79d4483Copy full SHA for 79d4483
Appendix C/1497.cpp
@@ -1,4 +1,4 @@
1
-// http://boj.kr/2532d97629b04d7c86f15db6bee08772
+// http://boj.kr/8b88c60fcf17452a9e602ef1bc17adde
2
#include <bits/stdc++.h>
3
using namespace std;
4
@@ -7,7 +7,7 @@ long long state[10];
7
8
int bit_cnt(long long x){
9
int ret = 0;
10
- for(int i = 0; i < m; i++){
+ for(int i = 0; i < max(n, m); i++){
11
ret += (x >> i) & 1;
12
}
13
return ret;
@@ -29,7 +29,7 @@ int main(){
29
pair<int, int> ans = {0, -1}; // {연주할 수 있는 곡의 수, 필요한 기타의 수}
30
for(int tmp = 0; tmp < (1 << n); tmp++){
31
long long comb = 0; // 조합한 결과
32
+ for(int i = 0; i < n; i++){
33
if((tmp & (1LL << i)) == 0)
34
continue;
35
comb |= state[i];
0 commit comments