codeforces 414B B. Mashmokh and ACM(dp)】的更多相关文章

题目链接: B. Mashmokh and ACM time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participat…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
                                             B. Mashmokh and ACM                                                                                             time limit per test 1 second                                                                …
http://codeforces.com/problemset/problem/414/B B. Mashmokh and ACM time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh d…
[Codeforces 865C]Gotta Go Fast(期望dp+二分答案) 题面 一个游戏一共有n个关卡,对于第i关,用a[i]时间通过的概率为p[i],用b[i]通过的时间为1-p[i],每通过一关后可以选择继续下一关或者时间清0并从第一关开始,先要求通过所有关卡的时间和不能超过R才算彻底通关,问直到彻底通关位置的游戏时间的期望值为多少 分析 二分从头开始通关的用时期望mid 设\(dp[i][j]\)表示通前i关,当前时间为j的期望,倒推期望. 若超时重新开始,则\(dp[i][j]…
[CodeForces - 1225E]Rock Is Push [dp][前缀和] 标签:题解 codeforces题解 dp 前缀和 题目描述 Time limit 2000 ms Memory limit 524288 kB Source Technocup 2020 - Elimination Round 2 Tags binary search dp *2200 Site https://codeforces.com/problemset/problem/1225/E 题面 Examp…
[Codeforces 553E]Kyoya and Train(期望DP+Floyd+分治FFT) 题面 给出一个\(n\)个点\(m\)条边的有向图(可能有环),走每条边需要支付一个价格\(c_i\),需要的时间为\([1,T]\)中随机的整数,时间为\(j\)的概率为\(p_{i,j}\).从\(1\)出发走到\(n\),如果到\(n\)的时间超过\(T\),就需要再支付\(X\).找出一条路径,使得支付钱数的期望值最小.输出最小期望. \(n \leq 50,m \leq 100,T \…
http://codeforces.com/problemset/problem/414/B 题目大意: 题意:一个序列B1,B2...Bl如果是好的,必须满足Bi | Bi + 1(a | b 代表a整除b), 求长度为K,元素大小小于等于N的序列个数 思路:f[i][j] 代表在序列的第i位,当前数字为j的方案数 #include<cstdio> #include<cmath> #include<algorithm> #include<cstring>…
题意:给你n和k,然后找出b1, b2, ..., bl(1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n),并且对所有的bi+1%bi==0,问有多少这样的序列? 思路:dp[i][j] 表示长度为i,以j为结尾有多少.dp[i][j]+=dp[i-1][s],j%s==0; #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ; int n,k; ][];…
$dp$. 记$dp[i][j]$表示已经放了$i$个数字,并且第$i$个数字放了$j$的方案数.那么$dp[i][j] = \sum\limits_{k|j}^{}  {dp[i - 1][k]}$.答案为$\sum\limits_{k=1}^{m}  {dp[n][k]}$ #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #i…