皇帝的新衣(改编)
One day, the king of the country was in want of a new coat. Vulnerable as the country was, the king insisted on his request and issued a new law, regardless of the fact that tons of enemies were attacking his army. In the capital, the crowd, including barbers, tailors, and anyone else, all blindly believed that they were safe, and the king’s army would defend them. In such a situation, the crowd actively responded to the king’s ridiculous ideas. After all, the constitution in the crowd’s mind was that the king was the supreme and they were supposed to follow him without hesitation. Thus, they racked their brains to tailor coats day and night, and various elaborate coats were sent to the king. Yet, the king was unsatisfied with these products.
As time went by, the king was virtually out of patience. Just at this moment, two men came in, saying that they were able to satisfy him. Bursting into laughter, the king distributed them a lot of money to tailor the product.
Different from the fairy tale, they really made an amazing costume, which looked like “God’s coat”. While dressed in this costume, the king was so excited that he behaved flakily. The king did not only addicted to wearing costumes, but also loved drinking wine. So he exploited his slave to construct a cellar for him. And then he stored a[i] bottles of wine into it every day. When the cellar was full of wine on the k-th day, he still wanted to store wine every day. Here come the solution: He first constructed a p-sequence: p[1],p[2]...p[k], where p[1] p[2] ... p[k]=1. Then he choose a number i among 1 to k, where number i has the probability p[i] to be chosen. After that, he drank the wine stored on the i-th day before the current day and stored the same amount of wine back into the cellar again. Let the amount of wine stored on the i-th day be f[i]. Given the amount of wine stored in the first k days and the expected amount of the next k days(which means, from the k 1-th day to the 2k-th day). During these days, he was laughing and dancing in the “hall”, not noticing that the “hall” is actually a jail! He boasted his new coat to “the crowd”. Yet, that was his illusion, because he had already been addicted to the drugs hiding in the wine and coat.