要解决的核心问题是:求1~x(在base进制下)的区间内各数位上的数字之和恰好为m的数的个数对于每一个询问,先预处理一个DPdp[i][j]表示在base进制下 长度为i且 数位之和为j的数的个数然后在calc()中一位一位统计过去就好了View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;typedef __int64 lld;lld dp[32][331];//dp[i][j]:长度为i,数位和为j时的数的个数void init(int lim, Read More
posted @ 2012-05-15 13:44 Because Of You Views(338) Comments(0) Diggs(0) Edit