Function to represent S as the sum of K positive letegers less than or equal to N
function solve ( S , K , N ) { if ( K > N ) { document . write ( " " ) ; return ; } let max_sum = 0 , min_sum = 0 ; for ( let i = 1 ; i <= K ; i ++ ) { min_sum += i ; max_sum += N - i + 1 ; }