Easy to understand (Beats 91.50% of users)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N*N) in worst case.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long countPairs(vector<int>& nums, int k) {\n        std::ios_base::sync_with_stdio(false);\n        std::cout.tie(nullptr);\n        std::cin.tie(nullptr);\n        unordered_map<int,int> mpp;\n        long long ans=0;\n        for(auto i:nums){\n            int get=__gcd(k,i);\n            int need=k/get;\n            for(auto j:mpp){\n                if(j.first%need==0){\n                    ans+=j.second;\n                }\n            }\n            mpp[get]++;\n        }\n        return ans;\n    }\n};\n\n\n```
['C++']