TopCoder problem "MegaCoolNumbersEasy" used in SRM 431 (Division II Level One)



Problem Statement

    A positive integer is called a mega cool number if its digits form an arithmetic progression. An arithmetic progression is a sequence of numbers in which the difference between any two consecutive numbers is the same. Return the number of mega cool numbers between 1 and N, inclusive.
 

Definition

    
Class:MegaCoolNumbersEasy
Method:count
Parameters:int
Returns:int
Method signature:int count(int N)
(be sure your method is public)
    
 

Constraints

-N will be between 1 and 1,000, inclusive.
 

Examples

0)
    
1
Returns: 1
The only mega cool number not greater than 1 is 1.
1)
    
110
Returns: 99
All numbers between 1 and 99 are mega cool.
2)
    
500
Returns: 119

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=10281

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=13522&pm=10281

Writer:

Gluk

Testers:

PabloGilberto , Olexiy , ivan_metelsky

Problem categories:

Simple Search, Iteration