Processing math: 100%
Divisible by d - MarisaOJ: Marisa Online Judge

Divisible by d

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integers array A of n elements. Count the number of subarray with sum divisible by d. A subarray is a contiguous sequence of elements within an array. For example, given an array B=[1,2,3,4,5], array C = [2,3,4] is a subarray of B. ### Input - The first line contains 2 integers n,d. - The second line contains n integers Ai. ### Output - Print the number of subarray with sum divisible by d. ### Constraints - 1≤n,d≤105. - |Ai|≤109. ### Example Input: 5413-23-5 Output: 4