Easy Cpp solution
\nWe will use the brute force which will give the time complexity O(N*(N-1)) i.e O(N^2) where  N is length of array\n\n int countPairs(vector<int>& nums, int k)
\nWe will use the brute force which will give the time complexity O(N*(N-1)) i.e O(N^2) where  N is length of array\n```\n int countPairs(vector<int>& nums, int k) {\n        int n = nums.size() , pairs = 0;\n\t\t\n        for(int i = 0 ; i < n; i++)\n        {\n            for(int j=i+1; j<n; j++)\n            {\n                if(nums[i] == nums[j] && (i*j) % k  ==  0)\n                    pairs++;\n            }\n        }\n        return pairs;\n    }\n```
['C++']