题目描述
Throughout history there have been many different interesting numbers or types of numbers. One of these types is amicable numbers. Amicable numbers are a pair of numbers with the following property: the sum of all of the proper divisors of the first number (not including itself) exactly equals the second number while the sum of all of the proper divisors of the second number (not including itself) likewise equals the first number.
The set of 220 and 284 was the first known set of amicable numbers. Pythagoras discovered the relationship and coined the term amicable because he considered the numbers to be a symbol of friendship.
For example let's show that 220 & 284 are amicable numbers:
First we find the proper divisors of 220:
1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110
If you add up all of these numbers you will see that they sum to 284.
Now find the proper divisors of 284:
1, 2, 4, 71, 142
These sum to 220, and therefore 220 & 284 are amicable numbers.
You should be able to declare a number is a amicable or not.
Number of cases will be < 10
The Input number is < 100,000
Input
The first line of the input file contains the number cases followed by set of numbers one in each new line.
Output
If the number is not an amicable number it should print no, if it is an amicable number it should print yes and the amicable number of it.
Example
Input:
4
1184
2620
3550
5020
Output:
Yes, amicable with 1210
Yes, amicable with 2924
No
Yes, amicable with 5564
输入格式
见题面
输出格式
见题面