1 人解决,6 人已尝试。
1 份提交通过,共有 19 份提交。
9.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
Numbers are interesting, but some are inherently more interesting than others, by various criteria. Given a collection of numbers, you are to find the most interesting ones.
Attribute Name | Description | Example Numbers |
---|---|---|
prime | The number is prime(not divisible by numbers other than itself and 1). | 2, 113, 232582657 - 1 |
square | The number is the second power of an integer. | 4, 225, 1089 |
cube | The number is the third power of an integer. | 8, 3375, 35937 |
quad | The number is the fourth power of an integer. | 16, 50625, 1185921 |
sum-multiple | The number is a multiple of the sum of its digits. | 1, 24, 100 |
multiple-multiple | The number is a multiple of the number made when multiplying its digits together. | 1, 24, 315 |
A number X is more interesting than another number Y if it has more attributes than Y. For the purposes of this problem, the attributes that are interesting are:
Note that 0 has no multiples other than itself, and 1 is not prime.
In addition to the above attributes, there are also those which depend on the other numbers in a given collection:
Attribute Name | Description |
---|---|
factor | The number is a factor of another number in the collection. |
multiple | The number is a multiple of another number in the collection. |
other-square | The number is the second power of another number in the collection. |
other-cube | The number is the third power of another number in the collection. |
other-cube | The number is the third power of another number in the collection. |
other-quad | The number is the fourth power of another number in the collection. |
other-sum-multiple | The number is a multiple of the sum of digits of another number in the collection. |
other-multiple-multiple | The number is a multiple of the number made when multiplying the digits of another number in the collection together. |
This makes for a total of thirteen possible attributes. Note that meeting the criteria for a particular attribute in multiple ways (1 is the factor of all other numbers, for example) still only counts as a single instance of an attribute.
Given a collection of numbers, you are to determine which numbers in that collection are most interesting.
Input to this problem will begin with a line containing a single integer N (1 ≤ N ≤ 100) indicating the number of data sets. Each data set consists of the following components:
For ach data set in the input, output the heading “DATA SET #k” where k is 1 for the first data set, 2 for the second, and so on. For each data set, print the number or numbers that are most interesting in the collection. If more than one number ties for “most interesting,” print them in ascending order, one to a line.
2 2 1 100 3 2 3 4
DATA SET #1 1 DATA SET #2 4
1 人解决,6 人已尝试。
1 份提交通过,共有 19 份提交。
9.9 EMB 奖励。
创建: 16 年,3 月前.
修改: 7 年,2 月前.
最后提交: 13 年,12 月前.