#K95312. Check Subarray Sum

    ID: 38836 Type: Default 1000ms 256MiB

Check Subarray Sum

Check Subarray Sum

You are given an integer array nums and an integer k. Your task is to determine if the array has a continuous subarray of size at least 2 whose elements sum up to a multiple of k. In other words, check whether there exists a subarray of at least two elements such that its sum is of the form $$m \times k,$$ where \( m \in \mathbb{Z} \).

Note that when k = 0, a valid subarray is one where the sum is exactly 0, and in particular, the presence of consecutive zeros constitutes a valid solution. Your solution should read input from stdin and write the answer to stdout as either True or False.

inputFormat

The input consists of three lines:

  1. An integer n representing the number of elements in the array.
  2. n space-separated integers which represent the array nums.
  3. An integer k.

outputFormat

Output a single line with either True or False depending on whether there exists a continuous subarray of size at least 2 whose sum is a multiple of k.

## sample
5
23 2 4 6 7
6
True