, :
r.resize(length);
int current_write_point = 0;
for (int i = 0; i < length; ++i){
r[current_write_point] = i;
current_write_point += (data[i] < 9);
}
r.resize(current_write_point + 1);
, boolean , .
, 9. -, , , , 0-15 (, , 15). , 8 , 9:
-, . , x < 0, x 9, , x < 9:
#include <iostream>
int n(int x) {
return x & (1 << 31);
}
int main() {
int current_write_point = 0;
for (int i = 0; i < length; ++i){
r[current_write_point] = i;
current_write_point += n(data[i] - 9);
}
}