DWITE Online Computer Programming Contest, May 2010, Problem 1
In some games the character equipment is fairly basic — one either has a particular type of item equipped, or not ("a shield is equipped"). A single bit is enough to hold this information, but memory is allocated and accessed in larger chunks. A single character, 1 byte in size, holds enough space for any configuration of 8 such binary equips (8 bits in a 1 byte).
The input will contain 5 lines, each an integer , single space delimiter, and an integer . is the position of the bit, where 0 is the least significant bit and 7 is the most significant bit.
The output will contain 5 lines, corresponding to each case of input. 1 if the item is present, 0 if item is not.
Reminder of how binary digits work: it's all sums of powers of 2.
Where ITEM 7 is represented by ; and ITEM 0 together with ITEM 1 are .
0 0 1 0 1 1 2 1 255 7
0 1 0 1 1