[数位DP] BZOJ 4521 [Cqoi2016]手机号码

题解:http://www.cnblogs.com/ccz181078/p/5379967.html


数位DP和喜闻乐见的前缀和


#include
#include
#include
using namespace std;
typedef long long ll;

inline char nc()
{
	static char buf[100000],*p1=buf,*p2=buf;
	if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
	return *p1++;
}

inline void read(ll &x){
	char c=nc(),b=1;
	for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
	for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}

ll L,R;
ll f[15][10][3][2][2][2];

inline ll Calc(ll x){
	int num[16],p=0;
	ll ret=0,itmp=x;
	while (itmp) num[++p]=itmp%10,itmp/=10;
	for (int i=1;i


你可能感兴趣的:(DP)