#21774: UVA10041


jayw711kb@gmail.com (Jay Huang)

School : 國立虎尾科技大學
ID : 119439
IP address : [27.247.130.217]
Last Login :
2020-09-15 15:55:19
a737. 10041 - Vito's family -- UVa10041 | From: [39.11.3.169] | Post Date : 2020-07-18 09:44

 

題意:找到一個房子,使得該房子到各個親戚家的距離為最小值

total=sigma(di)=sigma(|s-xi|)=|s-x1|+|s-x2|+...+|s-xn|; //1<=i<=n

 

解法:

1.排序

2.找出中位數不是平均值

3.算出答案

 

 
ZeroJudge Forum