Statistics

Problem Statement for "Armstrong"

Problem Statement

PROBLEM STATEMENT
If the sum of the cubes of the digits of a number equals the number, then that
number is said to be an Armstrong number.  Write a method that counts the
number of Armstrong numbers in a list.

DEFINITION
Class Name:  Armstrong
Method Name: count
Parameters:  int[]
Return:      int

Method signature (be sure your method is public): int count(int[] n)

TopCoder will ensure the validity of the input:
- n is an int[] that is between 0 and 50 inclusive in size
- each number in the int[] is between 0 and 1000000 inclusive

NOTES
- If the int[] n is empty, then the method should return 0. 

EXAMPLES:
{153, 21} returns 1;
153:   1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153  This is an Armstrong number
 21:   2^3 + 1^3 != 21                       This is not an Armstrong number
There was one Armstrong number in the set so the method returns 1.

Examples:
{0,1}               returns 2
{153,4,232,407,999} returns 2
{5,6,7}             returns 0
{}		    returns 0 

Definition

Class:
Armstrong
Method:
count
Parameters:
int[]
Returns:
int
Method signature:
int count(int[] param0)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: