update gitignore. update compile.sh
This commit is contained in:
@@ -2,20 +2,18 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
bool comp(unsigned int a, unsigned int b) {
|
||||
int cnt_bit(unsigned int a) {
|
||||
int res1 = 0;
|
||||
while (a != 0) {
|
||||
res1 += a & 1;
|
||||
a = a >> 1;
|
||||
}
|
||||
|
||||
int res2 = 0;
|
||||
while (b != 0) {
|
||||
res2 += b & 1;
|
||||
b = b >> 1;
|
||||
}
|
||||
return res1;
|
||||
}
|
||||
|
||||
return res1 < res2;
|
||||
bool comp(unsigned int a, unsigned int b) {
|
||||
return cnt_bit(a) < cnt_bit(b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user