A. Contest Start
题解
每一个参加者都会引起后面$\frac{t}{x}$个参与者的不满。但是对于最后几位参与者来说,因为后面没有更多参与者了,所以需要减去。
代码
Java
Submission #120127640 - Codeforces
Codeforces. Programming competitions and contests, programming community

C++
Submission #120134792 - Codeforces
Codeforces. Programming competitions and contests, programming community

B. Love Song
题解
统计各个字母的前缀和即可。
代码
Java
Submission #120126491 - Codeforces
Codeforces. Programming competitions and contests, programming community

C++
Submission #120135206 - Codeforces
Codeforces. Programming competitions and contests, programming community

C. Stable Groups
题解
首先我们不考虑加人的情况,直接进行分组。这个只需要直接模拟即可。
这些分组之间的差值一定是大于x的。如果我们添加学生后差值小于x,则可以将这两个group合并。所以自然的,我们将差值从小到大排序,优先合并这些即可。
代码
Java
Submission #120130274 - Codeforces
Codeforces. Programming competitions and contests, programming community

C++
Submission #120136749 - Codeforces
Codeforces. Programming competitions and contests, programming community

D. PriceFixed
我们会发现买的商品总数不变,只是调换购买顺序的问题。在发现了折扣与位置和b强相关之后,此题得解。
Codeforces Round #727 PriceFixed 题解 (Java/C++)
题解显然,对于每种商品,我们一定是恰好买a个,不会多买。也就是买的商品总数不会变(因为多买无非是为了凑折扣,但多买一个的代价正好等于折扣的好处)。于是我们可以考虑把每个商品放到不同的位置,只要这个商品对应的b值大于他的位置则可以打折。
