Easy To Understand || C++ Solution
Code\n\nclass Solution {\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        long long ans=0;\n        int
# Code\n```\nclass Solution {\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        long long ans=0;\n        int mx=nums[nums.size()-1];\n\n        // Finding the frequency of all elements in the array.\n        unordered_map<int,int> mp;\n        for(int i=0;i<nums.size();i++) {\n            mp[nums[i]]++;\n        }\n\n        // For each element iterating through its multiples and multiplying frequencies to find the answer.\n        for(auto x: mp) {\n            int val = x.first;\n            long long k = 0;\n            while(val<=mx) {\n                int idx = lower_bound(nums.begin(), nums.end(), val) - nums.begin();\n                // adding all the elements which are greater and equal to val;\n                k+=(nums.size()-idx);\n                val+=x.first;\n            }\n            ans += k*x.second;\n        }\n        return ans%1000000007;\n    }\n};\n```
['Binary Search', 'Sorting', 'C++']