0
Follow
0
View

# a&b=c given c and b how do I get back to a

ctrl61 注册会员
2023-02-28 20:34
< div class = "how e397 data - v - 3967" = "" >

djzhao76 注册会员
2023-02-28 20:34
)) b = int( input ( "Please enter value of b: " )) a = c - b print ( "The value of a is:" , a) .
< !- - - - - >

This doesn't solve for a, because when b has a 0 bit and c has a 0 bit, you don't know if a has a 0 bit or a 1 bit, because either works.

So there are many values for a

dishasi 注册会员
2023-02-28 20:34
< div class = "how e397 data - v - 3967" = "" >

if you want to ask any, a = c - b

dishasi 注册会员
2023-02-28 20:34

& Isn't this a bit and operation, just calculate a=c^b,
Explain:
Suppose that ampersand; It's a bit and, so a & The result of b is the result of adding and bits of a and b. So if we have b and c, we can add b and c bit by bit to get d, and then we can xor d and b to get a.

diotzhou 注册会员
2023-02-28 20:34
< div class = "how e397 data - v - 3967" = "" >

not too yeah...
int a = 330;
int b = -4;
int c = a & b; //328

int d = b & c; //328
int e = b ^ d; //-332

Publish Time
2023-02-28 20:34
Update Time
2023-02-28 20:34