1999. Programming Contest

Results

Seven teams from various schools in Idaho participated in the fourth High School programming contest. There were a total of 21 students and the teams were from the following schools: (one team forgot to identify their high school on the entry form!) The first place team was from Centennial High School. The team members were John O'Rorke, John Rotman, Kevin Turner . The second place team was from Eagle High School. The team members were Chris Smith, Bart Robinson, Randy White. Both teams finished all three problems. Six teams finished at least one program correctly.

The Problems

Here are the problems used in the competition.






Problem 1: Similar Words

Description: Determine if two words come from the same base alphabet (lower-case letters only). If one word is a rearrangement of the other, the two words are called ``anagrams'', like ``rose'' and ``sore.'' This problem asks you to determine if two words use the same letters, but do not necessarily use an equal number of them. For example, ``curse'' and ``rescue'' come from the same base alphabet, but ``cure'' does not, since its base alphabet does not contain the letter `s' that both ``curse'' and ``rescue'' use.

Input: Each line of input contains two words. A pair of words ``last'' and ``pair'' will indicate the end of input. This last pair of words should not be processed for similarity.

Output: Output each pair of words and a message indicating that they use the same letters or different ones.

Example:

Input:   
smile miles		
this that	
rescue curse
last pair

Output:
smile miles ***same letters
this that ***different letters
rescue curse ***same letters

Problem 2: Integer Decompositions

Description: Find out how many different ways there are of writing a positive integer as a sum of three distinct positive integers, each of the three being greater than one.

Input: The program should read a single number from the standard input.

Output: The program should output the number of triples found and then exit.

Example: The following example shows the program being run five times with five different inputs.

Input:             Output:
10                    1

51                  169

100                 736

200                3136

1000              82336

Problem 3: Relatively Prime Integer Decompositions

Description: It is known that every integer greater than 17 may be written as the sum of three distinct integers, each greater than one, that are pairwise relatively prime; that is, no pair of the three integers have a common factor. Write a program that given a number , prints out how many such triples can be found.

Input: The program should read a single number from the standard input.

Output: The program should output the number of triples found and then exit.

Example: The following example shows the program being run five times with five different inputs.

Input:             Output:
10                    1

51                   26

100                 308

200                1281

1000              33929