K:Guanguan's Happy water (The Preliminary Contest for ICPC Asia Shenyang 2019)

Rather than drinking happy water, Guanguan loves storing happy water. So he bought a refrigerator and stored a_iai bottles of cola into it every day. When the storage is finished on the kk-th day, the refrigerator is full, but he still wants to store happy water every day. Here comes the solution: He first constructs a p-sequence: p_1p1p_2p2, ..., p_kpk, where p_1+p_2+...+p_k=1p1+p2+...+pk=1. Then he chooses an number ii among 11 to kk, where number ii has the probability p_ipi to be chosen. After that, he drinks the happy water stored on the ii-th day before the current day and stores the same amount of happy water back into the refrigerator again. Let the amount of happy water stored on the ii-th day be f_ifi. Given the amount of happy water stored in the first kk days and the expected amount of the next kk days(which means, from the k+1k+1-th day to the 2k2k-th day), could you help Guanguan figure out the sum of the expected amount of happy water stored during the first n

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值