## DWITE '09 R7 #1 - Binary Equipment

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### 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 .

#### Sample Input

0 0
1 0
1 1
2 1
255 7

#### Sample Output

0
1
0
1
1