TopcoderArchiveVisit Topcoder
SRM27 Feb 2002
SRM 68

DollarWords

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT

A large or complex word is sometimes referred to as a "dollar word". Here is a
simple way of assigning a "value" to a word: sum up the values of all the
letters in the word, where letter values are a=1, b=2, c=3, ... z=26,
regardless of case. This is the "value" of the word, in cents. A dollar word,
then, is a word whose value is calculated to be at least 100 cents. Given a
list of words, count the number of dollar words in the list.

DEFINITION
Class: DollarWords
Method name: count
Parameters: String[]
Return type: int

Method signature:  int count(String[] words); (be sure your method is public)

NOTES
- Count words whose values (calculated as described above) are >= 100.

TopCoder will ensure that:
* Each element of words contains only letters [A-Z,a-z].
* Each word will be 1 to 50 characters, inclusive.
* words will contain 0 to 50 elements, inclusive.

EXAMPLES

words = ["TopCoder","Single","Round","Match"];
The words in the list are valued as follows:
TopCoder = 20 + 15 + 16 + 3 + 15 + 4 + 5 + 18 = 96
Single = 19 + 9 + 14 + 7 + 12 + 5 = 66
Round = 18 + 15 + 21 + 14 + 4 = 72
Match = 13 + 1 + 20 + 3 + 8 = 45
Since none of these words are valued at 100 or higher, return 0.

words =
["some","excessively","gargantuan","terminology","saturates","this","collection"]
52        148           104          153          124       56
 108
return 5

words = []
return 0

words = ["antidisestablishmentarianism"]
                       307
return 1

Definition

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

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems