blob: 34812b814082e8f22ba8cb657e1b00e0f192d59f (
plain)
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
|
#include<stdio.h>
int has_dups(int n)
{
int hash[10] = {0};
if(n > 9999999999) return 1;
while(n)
{
if(hash[n%10]) return 1;
hash[n%10] = 1;
n /= 10;
}
return 0;
}
int special_integers(int n)
{
int count = 0;
for(int i = 1; i <= n; ++i) if(!has_dups(i)) count++;
return count;
}
int main()
{
printf("%d\n",special_integers(15));
printf("%d\n",special_integers(35));
return 0;
}
|