Embed
Email

Rest

Document Sample

Categories
Tags
Stats
views:
0
posted:
11/19/2011
language:
English
pages:
3
The Local Programming Contest

of the

Department of Computer Science and Technology

Plymouth State University

April 27, 2005





Problem 1. The Drunken Yankees Fans

A group of New York Yankees fans, heartbroken after their team lost to the Red Sox,

walk out of bar and each begin wandering the streets. Each fan walks one block at a time

in the directions north, south, east, west (N, S, E, and W). Your job is to determine

whether or not each fan, at the end of his/her wanderings, ends up at the same bar he/she

left.



The first line of the input will be a positive integer n representing the number of fans.

Each of the n lines that follow contains the directions that each fan walked. The

directions will be given as a string of characters (N, S, E, or W), separated by spaces.



Note that a fan may walk north and then turn around and walk south along the same

street. Also, you may assume that there are no obstacles that would prevent the fan from

walking in the indicated direction.



If the fan ends up at the same place, output the word “same.” Otherwise, output “not

same” followed by the ending position relative to the starting position. Output the number

of blocks away in the east/west direction, followed by the number of blocks in the

north/south direction.



Note if the fan is 0 blocks away in one of the directions, suppress output for that

direction. Input should be read an entire line at a time.



Sample Input:

3

ESENNWNWSWSSEN

SWNSWSES

NESSEN



Sample Output:

same

not same 3S 1W

not same 2E

The Local Programming Contest

of the

Department of Computer Science and Technology

Plymouth State University

April 27, 2005







Problem 2. Lines at the DMV

As a result of superstition your friendly neighborhood DMV has only ONE service

window open, and CLOSES after the 12th customer is finished! (13 is just too unlucky!)



You have to decide at what time did your DMV close?



The arrival times are the number of minutes after 7 am that a customer arrives. The

transaction times are the number of minutes the customer spends at the service window.



You may assume that no time is spent going from the line to the window. For example, if

a customer leaves at time 77, the next customer in the line starts getting service at time

77.



Your program should read the arrival time and transaction time together in one line for

each customer. Then compute the time as: DMV closes after minutes.



Sample Input:

12 3

31 8

32 10

37 6

38 20

42 14

52 3

55 9

70 18

80 4

85 17

95 7



Sample Output:

DMV closes after 147 minutes.

The Local Programming Contest

of the

Department of Computer Science and Technology

Plymouth State University

April 27, 2005





Problem 3. Lingo

In the game Lingo, there is a word to guess. The player makes a guess and is shown

which letters match in the same positions and which appear in the word but in a different

position.



Write a program that consists of a word to guess and a guess of that word with the same

length. The output is a string representing how the two strings match.



There should be an asterisk (*) in each position of the guess that matches the

corresponding letter of the word to guess, a pound sign (#) in each position of the guess

that matches a letter in the word to guess but not in the right position, and a period (.) in

all other positions of the guess.



Note multiple letters match only once. Pay careful attention to the sample output. In such

a case, it is the leftmost letters that are considered to match.



Also, matches in the right position take precedence over ones that are out of place. Again

pay very careful attention to the provided sample output.



Sample Input: Sample Input: Sample Input:

HOUSE CARRY COLORS

SOUTH ERROR REVERT



Sample Output: Sample Output: Sample Output:

#**.# .#*.. ....*.



Related docs
Other docs by Stariya Js @ B...
How we become literate
Views: 0  |  Downloads: 0
15189
Views: 0  |  Downloads: 0
Enrollment Agreement
Views: 0  |  Downloads: 0
seddc 061009 pm
Views: 0  |  Downloads: 0
Juvanec-KamenNaKamen-eng
Views: 0  |  Downloads: 0
Syllabus Macro Fall 10
Views: 0  |  Downloads: 0
23401
Views: 0  |  Downloads: 0
9-11-RPH-stonefabrication-ord-memo-agss
Views: 0  |  Downloads: 0
Junior_Pre_season_Soccer_League_application
Views: 0  |  Downloads: 0
guide_to_moodle_quizzes
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!