我是个蒟蒻
查看原帖
我是个蒟蒻
375390
mzjbiancheng楼主2020/12/27 15:31
#include<bits/stdc++.h>
using namespace std;
long long a,b,c[14];
long long dfs(int cut,bool pd,int y){
	if(cut==0)return 1;
	long long ans=0;
	int cu=y+2;
	int cu2=pd?c[cut]:9;
	for(int i=cu;i<=cu2;i++)ans+=dfs(cut-1,pd&&(i==c[cut]),i);
	return ans; 
}
int zs(long long x){
	int cut=0;
	while(x){
		c[++cut]=x%10;
		x/=10;
	}
	if(cut==0)return 0;
	if(a==1)return dfs(cut,1,-2)+1;
	return dfs(cut,1,-2);
}
int main(){
	cin>>a>>b;
	cout<<zs(b)-zs(a-1)<<endl;
	return 0;
}

为啥得了0分

2020/12/27 15:31
加载中...