You are viewing a single comment's thread. Return to all comments →
As a long LINQ one liner for fun:
static int luckBalance(int k, int[][] contests) { return contests.Select(contest => new { Luck = contest[0], Importance = contest[1] }).OrderByDescending(contest => contest.Luck).Select(contest => (contest.Importance == 1 && k-- <= 0) ? -contest.Luck : contest.Luck).Sum(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Luck Balance
You are viewing a single comment's thread. Return to all comments →
As a long LINQ one liner for fun: