CSES Problemset/Sorting and Searching
Subarray Divisibility
#1662Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopGiven an array of integers, your task is to count the number of subarrays where the sum of values is divisible by .
Input
The first input line has an integer : the size of the array.
The next line has integers : the contents of the array.
Output
Print one integer: the required number of subarrays.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
5 3 1 2 7 4
Expected Output
1
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
5 3 1 2 7 4
Expected Output
1