TopcoderArchive
SRM23 Dec 2008
SRM 431

MegaCoolNumbersEasy

Problem statement, definition, constraints, and public examples.

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

  1. 1
    Returns: 1
    The only mega cool number not greater than 1 is 1.
  2. 110
    Returns: 99
    All numbers between 1 and 99 are mega cool.
  3. 500
    Returns: 119
Back to all problems