Greedy Florist

  • + 0 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;