『算法-ACM竞赛-数学-数论』 HDU - 2854 Central Meridian Number (暴力打表)
『算法-ACM 竞赛-数学-数论』 HDU - 2854 Central Meridian Number (暴力打表)
A Central Meridian (ACM) Number N is a positive integer satisfies that given two positive integers A and B, and among A, B and N, we have
N | ((A^2)*B+1) Then N | (A^2+B)
Now, here is a number x, you need to tell me if it is ACM number or not.
Input
The first line there is a number T (0<T<5000), denoting the test case number.
The following T lines for each line there is a positive number N (0<N<5000) you need to judge.
Output
For each case, output “YES” if the given number is Kitty Number, “NO” if it is not.
Sample Input
2
3
7
Sample Output
YES
NO
Hint
X | Y means X is a factor of Y, for example 3 | 9;
X^2 means X multiplies itself, for example 3^2 = 9;
XY means X multiplies Y, for example 33 = 9.
题意:
给你一个数,如果能找出两个数 a,b 使得这三个数满足式子 1,但不满足式子 2,那么这个数 n 就不是符合要求的数,输出 NO
思路:
实在算不粗来了,把我写的代码打了个表,然后,发现最大是 240,然后其他,就没其他了。
1 |
|
达标代码
1 |
|