Trouble with Bitwise

Правка en3, от Quake, 2015-09-13 17:18:43

Hey guys, I was looking at solution to the problem BITS: http://codeforces.me/contest/484/problem/A . I found a line of code i couldn't understand: for(ll i = x ; i <= y ; i += ( ~ i& -~ i)) ans = i;

what does ( ~ i & -~ i ) do ?

Thank You

Теги bitmasks, bitwise operators

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Quake 2015-09-13 17:18:43 18
en2 Английский Quake 2015-09-13 17:17:45 69
en1 Английский Quake 2015-09-13 17:15:24 308 Initial revision (published)