301304: CF244B. Undoubtedly Lucky Numbers

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Undoubtedly Lucky Numbers

题意翻译

**题意** 若一个正整数的十进制表示(最高位不为0)只包含数字x和y,则我们称它为幸运数。例如,如果x=4,y=7,那么47,744,4等数是幸运的。请你计算n以内有多少个幸运数。 **输入格式** 第1行 一个整数n **输出格式** 第1行 n以内幸运数的个数(包括n) **数据范围** 1<=n<=1e9

题目描述

Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits $ x $ and $ y $ . For example, if $ x=4 $ , and $ y=7 $ , then numbers 47, 744, 4 are lucky. Let's call a positive integer $ a $ undoubtedly lucky, if there are such digits $ x $ and $ y $ $ (0<=x,y<=9) $ , that the decimal representation of number $ a $ (without leading zeroes) contains only digits $ x $ and $ y $ . Polycarpus has integer $ n $ . He wants to know how many positive integers that do not exceed $ n $ , are undoubtedly lucky. Help him, count this number.

输入输出格式

输入格式


The first line contains a single integer $ n $ $ (1<=n<=10^{9}) $ — Polycarpus's number.

输出格式


Print a single integer that says, how many positive integers that do not exceed $ n $ are undoubtedly lucky.

输入输出样例

输入样例 #1

10

输出样例 #1

10

输入样例 #2

123

输出样例 #2

113

说明

In the first test sample all numbers that do not exceed $ 10 $ are undoubtedly lucky. In the second sample numbers 102, 103, 104, 105, 106, 107, 108, 109, 120, 123 are not undoubtedly lucky.

Input

题意翻译

**题意** 若一个正整数的十进制表示(最高位不为0)只包含数字x和y,则我们称它为幸运数。例如,如果x=4,y=7,那么47,744,4等数是幸运的。请你计算n以内有多少个幸运数。 **输入格式** 第1行 一个整数n **输出格式** 第1行 n以内幸运数的个数(包括n) **数据范围** 1<=n<=1e9

加入题单

算法标签: