You are viewing a single comment's thread. Return to all comments →
int total = 0; Array.Sort(c); for (int i = c.Length - 1; i >= 0; i--) { total = total + (((c.Length - 1 - i) / k) + 1) * c[i]; } return total;
Seems like cookies are disabled on this browser, please enable them to open this website
Greedy Florist
You are viewing a single comment's thread. Return to all comments →
int total = 0; Array.Sort(c); for (int i = c.Length - 1; i >= 0; i--) { total = total + (((c.Length - 1 - i) / k) + 1) * c[i]; } return total;