Easy C++ Beats 93.35%
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*sqrt(k))$$\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        ios_base::sync_with_stdio(false);\n    cin.tie(NULL);\n        int n=nums.size();\n        long long ans=0;\n        unordered_map<int,int>m;\n        for(int i=0;i<n;i++){\n            int x=__gcd(k,nums[i]);\n            int d=k/x;\n            for(auto it:m){\n                if(it.first%d==0){\n                    ans+=it.second;\n                }\n            }\n            m[x]++;\n        }\n        return ans;\n    }\n};\n```
['C++']