摘要:
求最远曼哈顿距离,对于一个n维的空间,其中两点的曼哈顿距离为:|x1-y1|+|x2-y2|+|x3-y3|+|x4-y4|+……+|xn-yn| (两点的坐标分别为(x1,x2,……,xn)、(y1,y2,……,yn)) 以下以二维平面为例研究: 设距离最远的两点为i,j,可知所求的最大距离必定有以下四种形式之一: (xi-xj)+(yi-yj), (xj-xi)+(yi-yj), (xi-xj)+(yj-yi), (xj-xi)+(yj-yi) 变形一下,把相同点的坐标放到一起,即 (xi+yi)-(xj+yj), (-xi+yi)-(-xj+yj), (xi-yi)-(xj-yj), . 阅读全文
摘要:
Purifying MachineTime Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Problem DescriptionMike is the owner of a cheese factory. He has 2N cheeses and each cheese is given a binary number from 00...0 to 11...1. To keep his ch 阅读全文