Function to represent S as the sum of K positive integers less than or equal to N
void solve ( int S , int K , int N ) { if ( K > N ) { cout << " - 1" << endl ; return ; } int max_sum = 0 , min_sum = 0 ; for ( int i = 1 ; i <= K ; i ++ ) { min_sum += i ; max_sum += N - i + 1 ; }