题意:

                          如果一个数每一位之和为10的倍数..则称该数为Good Number..问A~B区间有多少个Good Numbers...

                 题解:

                          简单的数位dp...dp[x][y]代表位数为x时..各位之和%10=y的个数...然后用这个来更新答案..


Program:

#include<iostream>
#include<stack>
#include<queue>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<cmath>
#define ll long long
#define oo 1000000007
#define MAXN 100010
using namespace std;
ll dp[20][10];
char s[20];
ll count(ll x)
{
int len,i,j;
ll p=0,ans=0;
sprintf(s+1,"%I64d",x);
len=strlen(s+1);
for (i=1;i<=len;i++)
{
for (j=0;j<s[i]-'0';j++)
ans+=dp[len-i][(1000+10-j-p)%10];
p+=s[i]-'0';
}
if (p%10==0) ans++;
return ans;
}
void PreWork()
{
int i,j,x;
memset(dp,0,sizeof(dp));
dp[0][0]=1;
for (i=1;i<=18;i++)
for (x=0;x<10;x++)
for (j=0;j<10;j++)
dp[i][(j+x)%10]+=dp[i-1][j];
}
int main()
{
int C,cases;
ll A,B;
PreWork();
scanf("%d",&C);
for (cases=1;cases<=C;cases++)
{
scanf("%I64d%I64d",&A,&B);
printf("Case #%d: %I64d\n",cases,count(B)-count(A-1));
}
return 0;
}