luogu#P10426. [蓝桥杯 2024 省 B] 宝石组合
[蓝桥杯 2024 省 B] 宝石组合
Problem Description
In a mysterious forest, there lives a little elf named Xiao Lan. One day, he accidentally discovered a treasure hidden in a tree hole, filled with gems that sparkle with beautiful light. These gems have different colors and shapes, but the most eye-catching part is their unique “shininess” attribute. Each gem is born with a special ability to emit flashes of different intensities. Xiao Lan found a total of gems. The “shininess” attribute value of the -th gem is . Xiao Lan will choose three gems from these gems to form a combination. The beauty level after combining can be measured by the following formula:
$$S = H_a H_b H_c \cdot \frac{\operatorname{LCM}(H_a, H_b, H_c)}{\operatorname{LCM}(H_a, H_b) \cdot\operatorname{LCM}(H_a, H_c) \operatorname{LCM}(H_b, H_c)}$$Here, denotes the least common multiple function.
Xiao Lan wants the beauty level of the three-gem combination to be as high as possible. Please help him find the plan with the maximum beauty level. If there are multiple plans with the same , choose the one that is lexicographically smallest after sorting the three values in ascending order first.
Input Format
The first line contains an integer , representing the number of gems.
The second line contains integers , representing the shininess of each gem.
Output Format
Output one line containing three integers, representing the “shininess” of the three gems that satisfy the conditions.
5
1 2 3 4 9
1 2 3
Hint
Constraints
- For of the data, , .
- For of the data, .
- For all testdata, it is guaranteed that , .
Translated by ChatGPT 5