#K78532. Check Subarray Sum

    ID: 35107 Type: Default 1000ms 256MiB

Check Subarray Sum

Check Subarray Sum

Given an array of integers and an integer k, determine if the array has a continuous subarray of size at least 2 that sums up to a multiple of k. In other words, if there exists a subarray [ai, ai+1, ..., aj] with j - i ≥ 1 such that

\(\sum_{l=i}^{j} a_l \equiv 0 \pmod{k}\)

For the special case when k is 0, check whether there exists a subarray (with at least two elements) whose sum is exactly 0.

inputFormat

The first line contains an integer n, representing the number of elements in the array.
The second line contains n space-separated integers representing the elements of the array.
The third line contains an integer k.

outputFormat

Print True if there exists a continuous subarray of size at least 2 whose sum is a multiple of k; otherwise, print False.

## sample
5
23 2 4 6 7
6
True