File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 44using namespace std ;
55
66void zero (int **a, int m, int n){
7- bool *row = new bool [m];
8- bool *col = new bool [n];
7+ bool row[m], col[n];
98 memset (row, false , sizeof (row));
109 memset (col, false , sizeof (col));
1110 for (int i=0 ; i<m; ++i)
Original file line number Diff line number Diff line change @@ -22,16 +22,16 @@ int next(int x){
2222 int num = count_one (x);
2323 if (num == 0 || x == -1 ) return -1 ;
2424 for (++x; count_one (x) != num && x <= max_int; ++x);
25- if (x == max_int ) return - 1 ;
26- return x ;
25+ if (count_one (x) == num ) return x ;
26+ return - 1 ;
2727}
2828int previous (int x){
2929 int min_int = (1 <<31 );
3030 int num = count_one (x);
3131 if (num == 0 || x == -1 ) return -1 ;
3232 for (--x; count_one (x) != num && x >= min_int; --x);
33- if (x == min_int ) return - 1 ;
34- return x ;
33+ if (count_one (x) == num ) return x ;
34+ return - 1 ;
3535}
3636int next1 (int x){
3737 int xx = x, bit = 0 ;
You can’t perform that action at this time.
0 commit comments