Minimum value possible of a given function from the given set | C ++ implementation of above approach ; Function to find the value of F ( n ) ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define ll  long long NEW_LINE ll findF_N ( ll n ) { ll ans = 0 ; for ( ll i = 0 ; i < n ; ++ i ) ans += ( i + 1 ) * ( n - i - 1 ) ; return ans ; } int main ( ) { ll n = 3 ; cout << findF_N ( n ) ; return 0 ; }