12527

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string.h>
#include <time.h>

using namespace std;

int trace[5001];

int main()
{
	//clock_t t1,t2;
	//t1=clock();
	int cnt=0;
	int arr[10];
	for(int i=1;i<=5000;i++)
	{
		int tmp=i;
		trace[i]=cnt;
		memset(arr,0,sizeof(arr));

		while(tmp)
		{
			arr[tmp%10]++;
			if(arr[tmp%10]>1)
			{
				cnt++;
				trace[i]=cnt;
				break;
			}
			tmp/=10;
		}
	}

	int n,m;

	while(cin>>n>>m)
	{

		cout<<(m-n+1)-(trace[m] - trace[n-1])<<"\n";

	}
	//cout<<cnt<<"\n";
	/* t2=clock();
	 float diff ((float)t2-(float)t1);
    cout<<diff<<endl;
    */
	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *