1960 friend
Time Limit : 2000/1000 MS(Java/Others) | Memory Limit : 131072/65536 KB(Java/Others)
Submits : 76 | Solved : 41
Description
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.
Input
There are several lines in input file,each line has a nonnegative interger a ,(a is no more than 2^30)
Output
For the number a on each line of the input file ,if a is a friend number ,output ‘YES!’,otherwise output ‘NO!’
Sample Input
3
13121
12131
Sample Output
YES!
YES!
NO!
HINT
Source
HDU - 1719
[ Top ] | [ Submit ] | [ Statistics ] | [ Standing ]