Desolate and supported numbers

0

0 votes
Easy
Problem

A number Y is said to be a desolate number if it cannot be represented as a sum of positive number X + no.of active bits in binary representation of X.

A number Y is said to be a supported number if it is representable as a sum of positive number X + no.of active bits in binary representation of X i.e Y is supported by X.

Given a positive number you have to find out whether it is desolate or supported

INPUT FORMAT

First line is N denoting number of input values
Second line consists of N space seperated input values

CONSTRAINTS

1≤N≤1000
1≤v≤1000 where v is input value

OUTPUT FORMAT

If the number is desolate print DESOLATED
Else if the number is supported print SUPPORTED

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

The binary form of 2 is  01.So the number of active bits in 2 is 1
3 can be expressed as 2 + active bit count in 2 i.e. is 2+1
So 3 is supported number

For example 4 is a desolate number as 4 cannot be represented as X + numberOfActiveBits(X) for any number X les than 4.

Editor Image

?