Sequence with sum K and minimum sum of absolute differences between consecutive elements | C ++ implementation of the approach ; Function to return the minimized sum ; If k is divisible by n then the answer will be 0 ; Else the answer will be 1 ; Driver code
#include <iostream> NEW_LINE using namespace std ; int minimum_sum ( int n , int k ) { if ( k % n == 0 ) return 0 ; return 1 ; } int main ( ) { int n = 3 , k = 56 ; cout << minimum_sum ( n , k ) ; return 0 ; }