View Code of Problem 3594

#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std; 
int main(){ 
  	int t;
  	
  	cin>>t;
  	while(t--){
  		int a,b,count=0;;
  		cin>>a>>b;
  		for(int i=a;i<=b;i++){
  			int num[10]={0};
  			int n=i,flag=0;
  			while(n>0){
  				int p=n%10;
  				num[p]++;
  				if(num[p]>1){
  						flag=1;
  					break;
				  }
  				n/=10;
			  }
			if(flag==0)
				count++;
		}
		cout<<count<<endl;
	  }
	return 0;
}

Double click to view unformatted code.


Back to problem 3594