Submit | All submissions | Best solutions | Back to list |
HS08LN - Lonely Numbers |
Numbers which live on the Planet of Math are very friendly and eager to support other numbers. Each number has one special number, which it supports, chosen as follows. It counts the number of ones in its own binary representation, and adds this count to itself to obtain the value of the number it supports. That is, if j(m) means the number of ones in the binary representation of m, then m supports m+j(m). For example, the number eight (1000 in binary) supports nine, whereas nine supports eleven.
However, in this way not all the numbers get supported; some are left without support, and we call these numbers lonely. For example since one supports two, two supports three and three supports five, there is no number less than four, which would support four, so four is lonely.
Your task is for a given number recognize if it is lonely or supported by some number.
Input
The first line of each test one integer t, 1<= t <= 100, meaning how many numbers are to be checked. In each of the following t lines, one integer n, 1 <= n <= 1000000000 .
Output
For every checked number n write one line containing the word LONELY if n is lonely or the word SUPPORTED if given n there exists m such that n=m+j(m).
Example
Input: 3 4 9 11 Output: LONELY SUPPORTED SUPPORTED
Scoring
There will be 10 tests. Each test will be worth one point.
Added by: | Adam Dzedzej |
Date: | 2009-01-10 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: CLOJURE ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | High School Programming League |