Back
Close

Integer encoding

Statement
Given an integer [[n]] encoded on 32 bits (int32), retrieve the content of [[A]], [[B]], [[C]] and [[D]] knowing that : - [[A]] is a boolean using the right-most bit of [[n]] - [[B]] is an unsigned number using the 4 bits on the left of [[A]] in [[n]] - [[C]] is an unsigned number using the 6 bits on the left of [[B]] in [[n]] - [[D]] is an ASCII printable character (char) using the 7 bits on the left of [[C]] in [[n]]

Input description
<<Line 1 :>> An integer [[n]] encoded on 32 bits

Output description
<<Line 1 :>> The value of [[A]] ("true" or "false") <<Line 2 :>> The value of [[B]] (0 ≤ [[B]] < 16) <<Line 3 :>> The value of [[C]] (0 ≤ [[C]] < 64) <<Line 4 :>> The value of [[D]] (a printable character)

Constraints
0 ≤ [[n]] < 2^31 - 1

Game modes
Shortest

Test cases
Test 1 Test
Input
198830
Output
false 7 5 a

Validator 1 Validator
Input
202898
Output
false 9 4 c

Test 2 Test
Input
260095
Output
true 15 63 ~

Validator 2 Validator
Input
257851
Output
true 13 57 }

Test 3 Test
Input
140304
Output
false 8 32 D

Validator 3 Validator
Input
250863
Output
true 7 31 z

Test 4 Test
Input
67584
Output
false 0 0 !

Validator 4 Validator
Input
69667
Output
true 1 1 "

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants