Some frequently used tips in code

& : In C++, it represents address taking and bitwise AND operation. For example, the result of a number & 1 is the last bit of the binary. Then according to this feature, if(n & 1) can be equivalent to if(n % 2 == 1), the effect is to judge whether n is odd or not. (because the last digit of the odd number is 1);

 

 

keep more.....

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324820395&siteId=291194637