Question 9 || Hacker Rank
Bitwise Operator || Hacker Rank
In this
test, you will utilize legitimate bitwise administrators. All information is
put away in its double portrayal. The intelligent administrators, and C
language, use to address valid and to address misleading. The consistent
administrators think about bits in two numbers and return valid or misleading,
or , for each piece analyzed.
Bitwise AND
administrator and The result of bitwise AND is 1 assuming the relating pieces
of two operands is 1. In the event that either piece of an operand is 0, the
aftereffect of comparing bit is assessed to 0. It is signified by and.
Bitwise OR
administrator || The result of bitwise OR is 1 assuming somewhere around one
relating piece of two operands is 1. It is meant by ||.
Bitwise XOR
(selective OR) administrator ^ The aftereffect of bitwise XOR administrator is
1 assuming the comparing pieces of two operands are inverse. It is signified by
.
For
instance, for numbers 3 and 5,
3 = 00000011 (In Twofold)
5 = 00000101
(In Twofold)
What's
more, activity OR activity XOR activity
00000011 00000011 00000011
&
00000101 | 00000101 ^ 00000101
________
________ ________
00000001 = 1 00000111 = 7 00000110 = 6
You will be
given a number , and an edge, i1nnik$. Print the aftereffects of the and, or
and select or examinations on isolated lines, in a specific order.
Model
The aftereffects of the examinations are underneath:
a b as well as xor
1 2 0 3 3
1 3 1 3 2
2 3 2 3 1
For the and
correlation, the greatest is . For the or correlation, none of the qualities is
not exactly , so the greatest is . For the xor correlation, the most extreme
worth not exactly is . The capability ought to print:
2
0
2
Capability
Portrayal
Complete the calculate_the_maximum capability in the supervisor beneath.
calculate_the_maximum has the accompanying boundaries:
int n: the
biggest number to consider
int k: the consequence of a correlation should be lower than this number to be thought of Print the most extreme qualities for the and, or and xor examinations, each on a different line.
Input Configuration
The main line contains space-isolated numbers, and .
Requirements
Test Info 0
5 4
Test
Result 0
2
3
3
Clarification
0
All potential upsides of and are:
The most extreme conceivable worth of that is likewise is , so we print on first line.
The most extreme conceivable worth of that is additionally is , so we print on second line.
The most extreme conceivable worth of that is additionally is , so we print on third line.
0 Comments