2065Fair Number

2065   Fair Number

题目描述

If a hexadecimal integer (without leading 0),the sum of the former half number is equal to the sum of the latter half number,we call it a fair number. If the integer contains the odd numbers,then the middle of the integer neither fall within the first half,nor fall within the latter half.
   For example,hexadecimal number 1DE77 is a fair number,since 1 + D = 7 + 7,while the number of E is not involved in the calculation.
   All single-digit hexadecimal numbers (ie 0 ~ F) are fair numbers,but not F0 ( F0 can not be written in 0F0 ).
   Input a hexadecimal integer to determine whether this number is a fair number.

输入格式:

There will be multiple test cases.Each line of input contains a hexadecimal integer n (the number of bits is less than 1000).And the last line of 0 means the end of input which should not be processed.

输出格式:

 For each test case output a line,if the input hexadecimal number n is a fair number then output "Y",otherwise output "N".

输入样例 复制
F0
1DE77
0
输出样例 复制
N
Y

说明

1
1
通过提交
时空限制1000ms/64mb
题目来源
评测方式在线评测
题目类型
难        度