#define ll long long
2026-08-14 14:40:56
发布于:广东
2阅读
0回复
0点赞
#define ll long long
#include<cstdio>
ll get(ll x,int d){
ll res=0,p=1;
while(p<=x){
ll cur=x/p%10;
ll high=x/(p10);
ll low=x%p;
if(d!=0){
if(d<cur) res+=(high+1)p;
else if(d==cur) res+=highp+low+1;
else res+=highp;
}else{
if(cur>0) res+=high*p;
else res+=(high-1)p+low+1;
}
p=10;
}
return res;
}
int main(){
ll L,R;
scanf("%lld%lld",&L,&R);
for(int d=0;d<=9;d++){
ll ans=get(R,d)-get(L-1,d);
printf("%lld ",ans);
}
return 0;
}
这里空空如也







有帮助,赞一个