Huawei OD machine test - digital game (Java & JS & Python)

topic description

Xiao Ming is playing a game.

The system issues 1+n cards with an integer on each card.

The first card is given to Xiao Ming, and the next n cards are arranged in a continuous row according to the order in which they are dealt.

Xiao Ming needs to judge whether there are several consecutive cards among the last n cards, the sum of which can divisible the number on the cards in Xiao Ming's hand.

enter description

There are multiple sets of input data, each set of input data has two lines, and the input ends at the end of the file.

The first line has two integers n and m separated by spaces. m represents the number on the card issued to Xiao Ming.

The second line has n numbers, which represent the numbers on the subsequent n cards, separated by spaces.

output description

For each set of inputs, if there are several consecutive cards that meet the conditions, output 1; otherwise, output 0

Remark

  • 1 ≤ n ≤ 1000
  • 1 ≤ integer on the card ≤ 400000
  • The number of groups entered, not more than 1000
  • The use case ensures that the input is correct and does not need to consider illegal cases.

Example

enter 6 7
2 12 6 3 5 5
10 11
1 1 1 1 1 1 1 1 1 1
output

Guess you like

Origin blog.csdn.net/qfc_128220/article/details/130775047