首页 > 好朋友
头像 赵和杰
发表于 2020-07-28 18:31:02
见代码注释 #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll t, l, r, dp[30][20][2][2], ans; int bit[30];//存储每一位的值 ll DFS(i 展开全文
头像 瑜画
发表于 2020-08-21 09:26:46
统计0的个数,再判断有没有前导0,如果出现了007就记录,然后用相应的四位数组进行记忆化,比较常规的数位dp #include <bits/stdc++.h> using namespace std; #define int long long int a[20]; int f[20][ 展开全文
头像 122islzz
发表于 2022-02-14 16:31:15
设计好dp状态的含义,那么问题就很好解决了 dp[pos][sta]表示在数位pos上 之前所有数位满足的sta( 1 表示前面有一个"0" 2表示前面有"00" 3表示前面有"007" 当然是在没有前导0 且 当前pos位能取到最高位9的情况下)的方案数。 #include <iostre 展开全文

等你来战

查看全部