Codeforces Round #375 (Div. 2) A-The New Year: Meeting Friends
2016-10-08 21:38
393 查看
A-The New Year: Meeting Friends
中位数相关
我们可以推广到n个点的情况,即:数轴上有n个点,求到这n个点距离最小的一个点
下面用归纳法分析:
如果n=1,那么就取这个点
如果n=2,那么取x1和x2之间的任何一个点都是答案
如果n=3,那么取中间的那个点,就是答案
如果n=4,那么取中间的两个点所构成的闭区间就是答案
...
如果n是奇数,那么就是第(n+1)/2这个点
如果n是偶数,那么就是n/2这个点和(n/2)+1这两个点所构成的闭区间(任取一点)
中位数相关
我们可以推广到n个点的情况,即:数轴上有n个点,求到这n个点距离最小的一个点
下面用归纳法分析:
如果n=1,那么就取这个点
如果n=2,那么取x1和x2之间的任何一个点都是答案
如果n=3,那么取中间的那个点,就是答案
如果n=4,那么取中间的两个点所构成的闭区间就是答案
...
如果n是奇数,那么就是第(n+1)/2这个点
如果n是偶数,那么就是n/2这个点和(n/2)+1这两个点所构成的闭区间(任取一点)
相关文章推荐
- Codeforces Round #375 (Div. 2) A. The New Year: Meeting Friends 水题
- Codeforces Round #375 (Div. 2)A. The New Year: Meeting Friends(水题)
- CodeForces - 723A A. The New Year: Meeting Friends
- Codeforce 723A - The New Year: Meeting Friends
- CodeForces 723A-The New Year: Meeting Friends(很水)
- [codeforces]A. The New Year: Meeting Friends 水题
- 【Codeforces Round 375 (Div 2) A】【水题】The New Year Meeting Friends
- Codeforces723 A. The New Year: Meeting Friends (水题)
- CodeForces - 723A - A. The New Year: Meeting Friends
- codeforces 723A : The New Year: Meeting Friends
- 【69.77%】【codeforces 723A】The New Year: Meeting Friends
- A. The New Year: Meeting Friends
- Codeforces The New Year: Meeting Friends
- Mail-list精选-[Pragprog]What's your "new lauguage" for the new year?
- Codeforces Round #150 (Div. 2) C. The Brand New Function
- Codeforces Round #456 (Div. 2) B. New Year's Eve (贪心 )
- The Bangla New Year Contest 2013(2013区域赛练习)
- codeforces——723A—— The New Year: Meeting Friends
- Codeforces Round #100 (Div. 2) A - New Year Table
- CodeForces723-A. The New Year: Meeting Friends