Count distinct sum of pairs possible from a given range | C ++ program for the above approach ; Function to count distinct sum of pairs possible from the range [ L , R ] ; Return the count of distinct sum of pairs ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int distIntegers ( int L , int R ) { return 2 * R - 2 * L + 1 ; } int main ( ) { int L = 3 , R = 8 ; cout << distIntegers ( L , R ) ; return 0 ; }