1960 friend

时间限制 : 2000/1000 MS(Java/Others) | 内存限制 : 131072/65536 KB(Java/Others)

Submits : 2 | Solved : 2

题目描述

Friend numbers are defined recursively as follows.
(1)	number 1 and 2 are friend numbers 
(2)	if a and b are friend numbers,so as ab+a+b
(3)	only the numbers defined in (1) and (2) are friend numbers.
Now your task is to judge whether an interger is a friend numbers.

输入要求

There are several lines in input file,each line has a nonnegative interger a ,(a is no more than 2^30)

输出要求

For the number a on each line of the input file ,if a is a friend number ,output ‘YES!’,otherwise output ‘NO!’

输入样例

3
13121
12131


输出样例

YES!
YES!
NO!

提示


来源

HDU - 1719

[ 返回顶端 ] | [ 代码提交 ]