Preparing NOJ

H_TRC1

2000ms 65536K

Description:

The ternary expansion of a number is that numberwritten in base 3. A number can have more than oneternary expansion. A ternary expansion is indicatedwith a subscript 3. For example, 1 = 1
3 = 0.222... 3,and 0.875 = 0.212121...
3.The Cantor set is defined as the real numbersbetween 0 and 1 inclusive that have a ternaryexpansion that does not contain a 1. If a number hasmore than one ternary expansion, it is enough for asingle one to not contain a 1.For example, 0 = 0.000...
3 and 1 = 0.222... 3, sothey are in the Cantor set. But 0.875 = 0.212121...
3and this is its only ternary expansion, so it is notin the Cantor set.Your task is to determine whether a given number is in the Cantor set.

Input:

The input consists of several test cases.Each test case consists of a single line containing a number x written in decimalnotation, with 0 <= x <= 1, and having at most 6 digits after the decimal point.The last line of input is END. This is not a test case.

Output:

For each test case, output MEMBER if x is in the Cantor set, and NON-MEMBER if x isnot in the Cantor set.

Sample Input:

01
0.875
END

Sample Output:

MEMBER
MEMBER
NON-MEMBER

Note:

undefined

本题由旧版NOJ导入,来源:Waterloo local contest

Info

NOJ

Provider NOJ

Code NOJ1519

Tags

Submitted 2

Passed 1

AC Rate 50%

Date 04/20/2019 10:03:10

Related

Nothing Yet