pqr
Time limit2sMemory limit512 MB
Count index triples p<q<r whose product A[p]*A[q]*A[r] is divisible by K, for N up to 2000.
- Level
Medium5 of 10
- Topics
- Combinatorics, Number theory, Math
- Solved
- No attempts yet
Problem
You are given an array of numbers and an integer .
Write a program that counts the triples with such that is divisible by .
Input
The first line contains and , separated by a space. (, )
The second line contains the elements of in order from to . ()
Output
Print the number of triples with such that is divisible by .