随笔分类 - DP----概率DP
1
摘要:Valera is a coder. Recently he wrote a funny program. The pseudo code for this program is given below: Now Valera wonders: given the values x, k and p
阅读全文
摘要:A .Assignments 题意:给定距离D,以及N个飞机的速度Vi,单位时间耗油量Fi,总油量Ci。问有多少飞机可以到达目的地。 思路:即问多少飞机满足(Ci/Fi)*Vi>=D > Ci*Vi>=Fi*D; #include<bits/stdc++.h> #define ll long lon
阅读全文
摘要:Description 小Q同学现在沉迷炉石传说不能自拔。他发现一张名为克苏恩的牌很不公平。如果你不玩炉石传说,不必担心,小Q 同学会告诉你所有相关的细节。炉石传说是这样的一个游戏,每个玩家拥有一个 30 点血量的英雄,并且可以用牌 召唤至多 7 个随从帮助玩家攻击对手,其中每个随从也拥有自己的血量
阅读全文
摘要:题意:长度为n的排列,m次交换xi, yi,每个交换x,y有50%的概率不发生,问逆序数的期望 。n, m <= 1000 思路:我们只用维护大小关系,dp[i][j]表示位置i的数比位置j的数大的概率。 那么每次交换x和y。 假设x<y,那么区间就有三种: [1,x-1],[x+1,y-1], [
阅读全文
摘要:Description osu 是一款群众喜闻乐见的休闲软件。 我们可以把osu的规则简化与改编成以下的样子: 一共有n次操作,每次操作只有成功与失败之分,成功对应1,失败对应0,n次操作对应为1个长度为n的01串。在这个串中连续的 X个1可以贡献X^3 的分数,这x个1不能被其他连续的1所包含(也
阅读全文
摘要:There is a robot on the 2D plane. Robot initially standing on the position (0, 0). Robot can make a 4 different moves: After moving N times Robot gets
阅读全文
摘要:描述 一日,崔克茜来到小马镇表演魔法。 其中有一个节目是开锁咒:舞台上有 n 个盒子,每个盒子中有一把钥匙,对于每个盒子而言有且仅有一把钥匙能打开它。初始时,崔克茜将会随机地选择 k 个盒子用魔法将它们打开。崔克茜想知道最后所有盒子都被打开的概率,你能帮助她回答这个问题吗? 输入 第一行一个整数 T
阅读全文
摘要:数学期望 P=Σ每一种状态*对应的概率。 因为不可能枚举完所有的状态,有时也不可能枚举完,比如抛硬币,有可能一直是正面,etc。在没有接触数学期望时看到数学期望的题可能会觉得很阔怕(因为我高中就是这么认为的,对不起何老板了QwQ),避之不及。 但是现在发现大多数题就是手动找公式或者DP推出即可,只要
阅读全文
摘要:Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satis
阅读全文
摘要:King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday
阅读全文
摘要:495. Kids and Prizes Time limit per test: 0.25 second(s) Memory limit: 262144 kilobytes input: standard output: standard ICPC (International Cardboard
阅读全文
摘要:The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing i
阅读全文
摘要:BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sid
阅读全文
摘要:In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them meet. Nothing will happen if they are of the same species, tha
阅读全文
摘要:Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl). Homura wants to help her friend Madoka save the world. But because of the plot of the Boss
阅读全文
摘要:When wake up, lxhgww find himself in a huge maze. The maze consisted by N rooms and tunnels connecting these rooms. Each pair of rooms is connected by
阅读全文
摘要:Background If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and t
阅读全文
摘要:问题: Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets
阅读全文
摘要:时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 What is possibility of rolling N dice and the sum of the numbers equals to
阅读全文
摘要:描述 大家对斐波那契数列想必都很熟悉: a0 = 1, a1 = 1, ai = ai-1 + ai-2,(i > 1)。 现在考虑如下生成的斐波那契数列: a0 = 1, ai = aj + ak, i > 0, j, k从[0, i-1]的整数中随机选出(j和k独立)。 现在给定n,要求求出E(
阅读全文
1