023 (n & gt; 0 & amp; (n & amp; (n-1) = 0) (keep it up), emui023.0

Source: Internet
Author: User

023 (n> 0 & (n & (n-1) = 0) (keep it up), emui023.0

The role of the following code:

(N> 0 & (n & (n-1) = 0 ))

Simple: Determine whether n is an integer power of 2


Write programs calculate the number of binary digits that need to be modified from integer A to integer B.
Input: 31, 14
Output: 2

This question is also very simple: A and B are different or then calculate the number of 1 in the result

Code:

Int getModifyNum (const int vA, const int vB) {int Tmp = vA ^ vB; int Count = 0; while (Tmp> 0) {if (Tmp & 1) + + Count; Tmp >>= 1;} return Count ;}



It is known that the random variable Z follows the normal distribution N (0, Delta Region 2). If p (Z> 2) = 0023, p (-2 ≤ Z ≤ 2) =

0.954

It is known that the random variable ε normal distribution N (0 σ 2) If P (ε> 2) = 0023, P (-2 is less than or equal to ε less than or equal to 2) is equal? The answer is 0954


ε ~ If the normal distribution is N (0 σ 2), the image is symmetric on the Y axis.
P (-2 less than or equal to ε less than or equal to 2) = 1-1-P (ε> 2)-P (ε <2) = 1-2 P (ε> 2)



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.