[C++] | Upper_bound + Basic Maths
\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    int sumOfFlooredPairs(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int res=0;\n 
```\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    int sumOfFlooredPairs(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int res=0;\n        for(int i=0;i<nums.size();i++)\n        {\n            int prev_index=0,val=-1,cnt=1;\n            while(1)\n            {\n                val++;\n                int curr_index = upper_bound(nums.begin()+prev_index,nums.end(),(cnt*nums[i]-1))-nums.begin();\n                res = (res % mod + (val * (curr_index - prev_index)) % mod) % mod;\n                prev_index = curr_index,cnt++;\n                if(curr_index==nums.size())\n                    break;\n            }\n        }\n        return res;\n    }\n};\n```
['C']