Problem: 1753. 移除石子的最大得分
耗时100%,数学题,排序,若a + b <= c) return (a + b);
否则,a, b剩下的要尽量相等,所以答案是min(h, g) + c;
Code
class Solution { public: int maximumScore(int a, int b, int c) { vector<int> tr{a, b, c}; sort(tr.begin(), tr.end()); a = tr[0]; b = tr[1]; c = tr[2]; if(a + b <= c) return (a + b); int k = (a + b - c); int h = k / 2; int g = k - h; return min(h, g) + c; } };