摘要: 题目链接:http://lightoj.com/volume_showproblem.php?problem=1032思路:数位dp, 采用记忆化搜索, dp[pos][pre][have] 表示 pos处,前一位为pre, 当前有have个满足条件的状态。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 long long dp[34][2][34]; 8 int n, digit[34]; 9 10 long long dfs(int pos, int pre, int have, in... 阅读全文
posted @ 2014-01-14 20:30 ihge2k 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://lightoj.com/volume_showproblem.php?problem=1030思路:一直以来对这种概率题都挺感冒的=.=......还是说一下思路吧,dp[i]表示前i个位置所能能到的期望值,然后我们可以从后往前递推。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN = (100 + 10); 9 double dp[MAXN], num[MAXN];10 int n;11 12 int main(... 阅读全文
posted @ 2014-01-14 14:26 ihge2k 阅读(230) 评论(0) 推荐(0) 编辑