Home > Back-end >  No more than is less than the number of symbols to compare the two size
No more than is less than the number of symbols to compare the two size

Time:09-26

Given two Numbers x and y, if x<=y returns 1, otherwise it returns 0,
Where x and y are integer type int, request can only be used! ~ & amp; ^ | + & lt; <> These operators, the most used 24 operator,
And can only use the order structure, cannot use the if, while, for, etc., can't call any functions, cannot use casts,

CodePudding user response:

Return (((a - b) & gt;> 31) & amp; 0 x1) | (! (a ^ b))

CodePudding user response:

- if not to use, look at the inside of the circuit subtracter, is an operation,

CodePudding user response:

! ((y + (~ x + 1)) & gt;> 31)

CodePudding user response:

Return the x & lt;=y;

CodePudding user response:

Direct
Return the x & lt;=y? 1:0;
Is the most simple,
So it is not necessary to use! ~ & amp; ^ | + & lt; <> These operators

CodePudding user response:

I think the formula of 3 floor very right
Constructs the subtraction, and then constructs the expression of greater than zero

CodePudding user response:

Many people didn't notice the two questions
1 int is not necessarily a 32 bit
2 is equal to return 1

CodePudding user response:

reference 5 floor of the double cup with wine:

directlyReturn the x & lt;=y? 1:0;
Is the most simple,
So it is not necessary to use! ~ & amp; ^ | + & lt; <> The operator
is not it is not necessary to use these, is to use only these, you use less than the number and structure are disabled
  • Related