Pruthvi Patel

Pruthvi Patel

  • NA
  • 129
  • 23.5k

Sum and split array like below.

Dec 22 2016 10:48 PM
int arr[]={1,2,3,4,5,6,7,8,9,9,8,7,6,5,4,3,2,1,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9}
int innergroup=3;//vary from 1,2,..n
int outergroup=9; //vary from 1,2,..n
int mplit=2; //vary from 1,2,..n
res[0]=29 //1+4+7+9+6+3
res[1]=30 //2+5+8+8+5+2
res[2]=30 //3+6+9+7+4+1
res[3]=30 //9+6+3+1+4+7
res[4]=30 //8+5+2+2+5+8
res[5]=30 //7+4+1+3+6+9 
 
res[0]=first element of inner ingroup1 of split1+first element of inner ingroup2 of split1+first element of inner ingroup3 of split1+first element of inner ingroup1 of split2+first element of inner ingroup2 of split2+first element of inner ingroup3 of split2
 
and likewise
 
 

Answers (1)