-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12527.txt
86 lines (76 loc) · 924 Bytes
/
12527.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include<stdio.h>
int fun4(int);
int fun3(int);
int fun2(int);
int main()
{
int N,M,i,c,k,sum=0;
while(scanf("%d%d",&N,&M)!=EOF)
{
if(N>=1 && M>=1 && N<=5000 && M<=5000)
{
for(i=N;i<=M;i++)
{
if(i<=9)
sum=sum+1;
else if(i<=99)
{
c=fun2(i);
if(c==0)
sum+=1;
}
else if(i<=999)
{
c=fun3(i);
if(c==0)
sum+=1;
}
else
{
c=fun4(i);
if(c==0)
sum+=1;
}
}
printf("%d\n",sum);
sum=0;
}
}
return 0;
}
int fun2(int i)
{
int a,b;
a=i/10;
b=i%10;
if(a==b)
return 1;
else
return 0;
}
int fun3(int i)
{
int a,b,c,d;
a=i/100;
d=i%100;
b=d/10;
c=d%10;
if(a==b||b==c||a==c)
return 1;
else
return 0;
}
int fun4(int i)
{
int a,b,c,d,e,f;
a=i/1000;
f=i%1000;
b=f/100;
e=f%100;
c=e/10;
d=e%10;
if(a==b||a==b||a==c||a==d||b==c||b==d||c==d)
return 1;
else
return 0;
}