POJ3154 Graveyard】的更多相关文章

Graveyard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 1654   Accepted: 840   Special Judge Description Programming contests became so popular in the year 2397 that the governor of New Earck — the largest human-inhabited planet of the…
例题4  墓地雕塑(Graveyard, NEERC 2006, LA 3708) 在一个周长为10000的圆上等距分布着n个雕塑.现在又有m个新雕塑加入(位置可以随意放),希望所有n+m个雕塑在圆周上均匀分布.这就需要移动其中一些原有的雕塑.要求n个雕塑移动的总距离尽量小. [输入格式] 输入包含若干组数据.每组数据仅一行,包含两个整数n和m(2≤n≤1 000,1≤m ≤1 000),即原始的雕塑数量和新加的雕塑数量.输入结束标志为文件结束符(EOF). [输出格式] 输入仅一行,为最小总距…
Graveyard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 1289   Accepted: 660   Special Judge Description Programming contests became so popular in the year 2397 that the governor of New Earck — the largest human-inhabited planet of the…
1255. Graveyard of the Cosa Nostra Time limit: 1.0 secondMemory limit: 64 MB There is a custom among the Ural Mafiosi — a big Mafioso’s coffin is to be carried by all his subordinates. The length of the coffin (in meters) equals to the number of the…
Description   Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a special Alley of Contestant Memories (ACM) at the local graveyard. The ACM encircles…
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000即为距离: 详细解释:http://www.cnblogs.com/zywscq/p/4268556.html */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath&…
Graveyard Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a special Alley of Contestant Memories (ACM) at the local graveyard. The ACM encircles a gr…
题目链接:1388 - Graveyard 题目大意:在一个周长为10000的圆形水池旁有n个等距离的雕塑,现在要再添加m个雕塑,为了使得n + m个雕塑等距离,需要移动一些雕塑,问如何使得移动的总位移最小,输出最小值. 解题思路:可以将周长展成坐标来看,原来的n个雕塑在x[i] = i / n,而移动过后的位置应该在y[i] = i / (n + m),根据贪心的思想,x[i]肯定要移动到最近的y[j]上,问题就解决了,然后就讨论说会不会有两个雕像移动到同一个位置,大白书里给出了很好的反证法,…
POJ2100 Graveyard Design 题目大意:给定一个数n,求出一段连续的正整数的平方和等于n的方案数,并输出这些方案,注意输出格式: 循环判断条件可以适当剪支,提高效率,(1^2+2^2+..n^2)=n*(n+1)*(2n+1)/6; 尺取时一定要注意循环终止条件的判断. #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <…
Description King George has recently decided that he would like to have a new design for the royal graveyard. The graveyard must consist of several sections, each of which must be a square of graves. All sections must have different number of graves.…