问题描述
- C语言 这道题怎解 似乎并不难
-
DescriptionLasercat numbers are defined recursively as follows.
(1) numbers 1 and 2 are Lasercat numbers;
(2) if a and b are Lasercat numbers, so is (a+b)^2-1;
(3) only the numbers defined in (1) and (2) are Lasercat numbers.
Now your task is to judge whether an integer is a Lasercat number.Input
There are several lines in input. The first line of the input is the number of the cases, the next each line has a non-negative integer a, 0<=a<=1000000000.
Output
For the number a on each line of the input, if a is a Lasercat number, output “YES!”, otherwise output “NO!”.
Sample Input
2
3
14Sample Output
YES!
NO!
解决方案
http://download.csdn.net/download/yang_zhongyun/3864105
解决方案二:
打表啊。。最多sqrt(1e9)这么多。。
时间: 2024-12-08 12:24:54