高度由习惯堆积

分类 OJ:ZOJ 下的文章

February 17, 2019

ZOJ3822 Domination

题目Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboard with N rows and M column...
February 17, 2019

ZOJ3231 Apple Transportation

题目在一棵树上有n个节点(从0开始),在每个节点上都有一些苹果,现在需要在这棵树上把一些苹果从一个节点搬到另一个节点,使得这些节点上的苹果数的方差最小,从a节点搬运x个苹果到b节点的花费为x*dist(a,b),求满足条件的最小花费是多少?思路想了很久。。。一开始发现,对于一个节点而言,其上最终的苹果数一定是平均数(取整后的)或是平均数+1,我们定义前者为情况1,后者为情况2,这样我们就可以...