HBC208877Eliminate++题解

云中君 算法基础篇 54 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
ZYB likes to create puzzles for himself and then solve them. There areN NN distinct integers written in a line on the blackboard, and you decide to erase those numbers from the blackboard. Since you have just learned the concepts of median during the lecture, you invented the following erase-operation for three integers: wipe off the largest number and the smallest number from the blackboard, so that only the median of the three numbers remains. You decide to repeat the following process: choose three consecutive integers on the blackboard and apply erase-operationon them. After this operation, the number of integers on the blackboard will decrease by 2. Eventually, there will be only one integer left after this process is repeatedN12frac{N-1}{2}2N1 times. ZYB comes up with an interesting question: which integers may survive until the end?

ZYB likes to create puzzles for himself and then solve them. There are  N N N ( N N N is odd) distinct integers written in a line on the blackboard, and you decide to erase those numbers from the blackboard. Since you have just learned the concepts of median during the lecture, you invented the following erase-operation for three integers: wipe off the largest number and the smallest number from the blackboard, so that only the median of the three numbers remains. You decide to repeat the following process: choose three consecutive integers on the blackboard and apply erase-operation on them. After this operation, the number of integers on the blackboard will decrease by 2. Eventually, there will be only one integer left after this process is repeated N−12frac{N-1}{2}2N−1​ times.  ZYB comes up with an interesting question: which integers may survive until the end?

HBC208877Eliminate++题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC208877Eliminate++题解