【数位DP】 洛谷 P2602 [ZJOI2010]数字计数 P2657 [SCOI2009] windy 数

博客主要介绍了两道编程竞赛题目——ZJOI2010的数字计数和SCOI2009的windy数。作者分享了自己在解决这两个问题时的思路和代码实现,以及在理解题解后进行的修正。通过动态规划的方法,计算特定条件下的数字出现次数。文章强调了理解和应用题解的重要性,并对错误的判断条件进行了修正。
摘要由CSDN通过智能技术生成

洛谷 P2602 [ZJOI2010]数字计数

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
typedef long long int LL;
const int INF = 0x7fffffff, SCF = 0x3fffffff;
const int N = 14, M = 1e4+5, K = 1e6+4, T = 10;
LL dp[N][T][T];
int dig[N];
LL a,b;
LL Qmul(int p)
{
   
    LL base = 10, re = 1;
    while(p){
   
        if(p&1) re *= base;
        base *= base;
        p >>= 1;
    }
    return re;
}
LL fun(LL x,int num)
{
   
    LL ans = 0;
    int len = 0;
    while(x){
   
        dig[++len] = x%10;
        x /= 10;
    }
    for(int i=1; i<len; i++)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值