moofest专题

POJ - 1990 MooFest

题意:一排牛,每头牛(坐标pos,听力v),如果牛i和牛j交流的话,需要max{v[i],v[j]}*abs(pos[i]-pos[j]),求两两交流的总和。 思路:还是求逆序数对的思想,按坐标排序后,求当前小于它听力的牛们的总花费,然后倒序后再求一遍就是结果了, #include <iostream>#include <cstring>#include <algorithm>#incl

(POJ 1990)MooFest 树状数组 求一个数和他前面的所有数的值的差值之和

MooFest Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7716 Accepted: 3474 Description Every year, Farmer John’s N (1 <= N <= 20,000) cows attend “MooFest”,a social gathering of cows f

POJ 1990 MooFest

Description Every year, Farmer John’s N (1 <= N <= 20,000) cows attend “MooFest”,a social gathering of cows from around the world. MooFest involves a variety of events including haybale stacking, fen