记录编号 532702 评测结果 AAAAAAAAAA
题目名称 [SCOI 2009]windy数 最终得分 100
用户昵称 Gravatar梦那边的美好ET 是否通过 通过
代码语言 C++ 运行时间 0.022 s
提交时间 2019-06-02 10:11:36 内存使用 3.17 MiB
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int a1,a2,a[20],ans[2010]={202174,136131,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,0,0,0,155315,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,138214,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155315,136131,138503,138214,138252,138252,138214,138503,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138503,138214,138252,138252,138214,138503,136131,155315,0,0,0,138214,138252,138252,138214,138503,136131,155315,155315,0,0,0,138252,138252,138214,138503,136131,155315,155315,136131,0,0,0,138252,138214,138503,136131,155315,155315,136131,138503,0,0,0,138214,138503,136131,155315,155315,136131,138503,138214,0,0,0,138503,136131,155315,155315,136131,138503,138214,138252,0,0,0,136131,155315,155315,136131,138503,138214,138252,138252,0,0,0,155315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int ju(int x){
	int sum=0;
	if(x<10)return 1;
	while(x)a[++sum]=x%10,x/=10;
	a[sum+1]=a[0]=100;
	for(int i=1;i<=sum;i++)if(abs(a[i]-a[i-1])<=1||abs(a[i+1]-a[i])<=1)return 0;
	return 1;
}
int solve(int x){
	int sum=1,i=0;
	while((i+1)*1000000<=x)sum+=ans[i],i++;
	if(i*1000000==x)return sum;
	for(int j=i*1000000+1;j<=x;j++)sum+=ju(j);
	return sum;
}
int main(){
	freopen("bzoj1026.in","r",stdin);
	freopen("bzoj1026.out","w",stdout);
	scanf("%d%d",&a1,&a2);
	printf("%d\n",solve(a2)-solve(a1-1));
	return 0;
}