HBC237335[CQOI2017]老C的任务,树状数组,数据结构Generator题解

原来我爱你 算法基础篇 66 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Mr.L has a uniform random generator. In the beginning, Mr. L will input an integer NNN, and then pushes the generate button. The generator will output a random integer x∈[1,N]xin [1,N]x∈[1,N]. Then he will push the button again, and the generator will output a random integer y∈[1,x]yin [1,x]y∈[1,x] and so on and so forth. It is clear that the output is non-increasing, and after a number of pushes, the output will at last be 111. Now he wants to know the expected number of pushes to obtain 111 as output.

Mr.L has a uniform random generator. In the beginning, Mr. L will input an integer NNN, and then pushes the generate button. The generator will output a random integer x∈[1,N]xin [1,N]x∈[1,N]. Then he will push the button again, and the generator will output a random integer y∈[1,x]yin [1,x]y∈[1,x] and so on and so forth. It is clear that the output is non-increasing, and after a number of pushes, the output will at last be 111. Now he wants to know the expected number of pushes to obtain 111 as output.

HBC237335[CQOI2017]老C的任务,树状数组,数据结构Generator题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC237335[CQOI2017]老C的任务 树状数组 数据结构Generator题解