[Huawei OD machine test] Hopscotch 1 [2023 B roll | 100 points]

[ Huawei OD machine test]-Real questions!! Click here! !

Huawei OD machine test】Categorization of real test points!! Click here  !!

topic description

Hopscotch, also called hopscotch, is a worldwide children's game.

Game participants need to jump to the first grid until the last grid of the house in order in multiple rounds.

During hopscotch, you can jump forward or backward.

Assuming that the total number of grids in the house is count, the steps that Xiaohong may jump continuously in each round are placed in the array steps.

May I ask if there is a combination of steps in the array that allows Xiaohong to jump to the last grid in two rounds?

If so, please output the index and the smallest combination of steps.

Notice:

The number of steps in the array can be repeated, but the elements in the array cannot be reused.

The provided data guarantees that there is a combination that meets the requirements of the topic, and the combination of the index and the minimum number of steps is unique.

enter description

The input in the first line is the total number of houses count, which is an int integer type.

The second line of input is the number of steps that may be jumped continuously in each round, which is an int integer array type.

output description

Returns the index and the smallest combination of steps that meet the requirements (the order remains in the original order of steps)

Remark

count

Guess you like

Origin blog.csdn.net/goldarmour/article/details/131670785