找出1 - N中所有包含49字串的数字个数
思路:普通的数位DP,先找出布包含的,然后总数减去不包含的即可
代码:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 25;
int t;
char num[N];
ll dp[N][10], ans;
int main() {
scanf("%d", &t);
while (t--) {
scanf("%s", num);
int n = strlen(num);
sscanf(num, "%I64d", &ans);
ans++;
int pre = 0, flag = 0;
memset(dp, 0, sizeof(dp));
for (int i = 0; i......
阅读全文