标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1118 Accepted Submission(s): 664
#include<cstdio> int a[100005]; int num[10]; int main() { int T, t, f, l, r; a[0] = 0; for(int i = 1; i <= 100000; i++){ for(int j = 0; j < 10; j++){ num[j] = 0; } f = 0; t = i; while(t != 0){ if(num[t % 10] == 1){ f = 1; break; } else{ num[t % 10] = 1; } t = t / 10; } if(f == 0){ a[i] = a[i-1] + 1; } else{ a[i] = a[i-1]; } } scanf("%d", &T); while(T--){ scanf("%d%d", &l, &r); printf("%d\n", a[r] - a[l-1]); } }
标签:
原文地址:http://www.cnblogs.com/cyd308/p/4771360.html