You are viewing a single comment's thread. Return to all comments →
int totalLuckBalance = 0; int impContestCount = 0; List<int> tempList = new List<int>(); int index = 0; for(int i = 0; i < contests.Length; i++){ if(contests[i][1] == 0) totalLuckBalance += contests[i][0]; else{ impContestCount ++; tempList.Add(contests[i][0]); totalLuckBalance += contests[i][0]; } } if(impContestCount > k){ tempList.Sort(); int n = impContestCount - k; for(int j = 0; j < n; j++){ totalLuckBalance -= 2 * tempList[j]; } } return totalLuckBalance;
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 →
C# Code