1
Reply

Split and Sum array like below.

Pruthvi Patel

Pruthvi Patel

Jan 1 2017 9:06 AM
274

int arr[]={294 ,323, 959 ,1035 ,816,931, 1221, 1370, 672, 1146, 753 ,1306 ,985, 638, 919, 1036}

int innergroup=2;//vary from 1,2,..n

int outergroup=4; //vary from 1,2,..n

int mplit=2; //vary from 1,2,..n

res[0]=2678 //294+959+672+753

res[1]=3941 //816+1221+985+919

res[2]=3810 //323+1035+1146+1306

res[3]=3975 //931+1370+638+1036

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)