Question: Use java Demon Hunter Pair ( SlayerDuo ) A demon hunter who will go on a mission to hunt demons. Will be divided into two

Use java
Demon Hunter Pair (SlayerDuo)
A demon hunter who will go on a mission to hunt demons. Will be divided into two levels It is a group of 15 seniors who have higher power. (Power is in the range 80-100) with
The group of 15 other juniors were less powerful. (Power ranges from 50-70) Each person's power changes every day. Depends on training and
readiness of the body but will always be within the power range of their own group and the power of each person on any given day will not have the same value as other people's power
always on that day
Every time I go out to operate. The boss always sends seniors to work alongside juniors. The leader will determine that this time he needs a hunting team.
How many pairs of demons? pairs) and randomly name N seniors and N juniors. Those whose names are called will run and stand in front of the board in the order in which they were called.
For example, if this demon hunting operation The boss needs 4 pairs of demon hunters, and those who line up have the following powers.
The leader will see the power of each person on that day. and rearrange the rows in their own way For safety's sake, Chief
The senior with the highest power will be chosen alongside the junior with the lowest power. Followed by the seniors with the second highest power paired with the juniors with the second lowest power.
So on and so on until the last pair. It is always the senior with the lowest power paired with the junior with the highest power. From the example above, the leader will
Arrange new rows like this:
And the number of the pair with the greatest combined power will also be announced. To assign additional special missions For example from the example above.
The pair with the highest combined power is the 4th pair (if there is more than one pair with the highest combined power, the leader will choose the pair whose senior has higher power)
Problems
Have students write a program to get the number of pairs the leader needs (N) and a set of numbers representing the power of the Demon Hunter, respectively.
Random lining up at first Then the result is displayed as a set of numbers showing the power in the order that it should be from arranging the rows according to the method of
The leader is followed by the number of the pair with the highest combined power score.
Details of input and output data of the program as follows
input data
The input has 2 lines.
Line 1 consists of one integer. The number is the number of pairs the leader wants (N), where N always ranges from 1-15.
Line 2 consists of N*2 integers, representing the power of each demon hunter who lines up. According to the requirements in the question
Note: Always require that every input data have the correct value according to the format, scope, and set of possible values according to the requirements in the problem. Students do not need to validate their input.
Export data
The output data has 2 lines.
Line 1 consists of N*2 integers, representing the power of each demon hunter who lines up in a new order.
Arrangement of the boss
Line 2 consists of one integer, the number of the pair with the highest combined power.
Example 1
input data
4
8850995589926269
Export data
9950925589628869
4
Example 2
input data
3
568850905589
Export data
905089558856
2
Example 3
4
9850955589628269
Export data
9850955589628269
3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!