Canadian Computing Competition: 2006 Stage 1, Senior #3
Romy and Jules have been talking with each other on their cell phones. Unfortunately, their parents dislike each other and have decided that they can no longer call each other. In fact, their parents have taken their cell phones away. So, Romy and Jules must find some other way to communicate. After searching the web for ideas, they have decided to build a "tin can" telephone.
Simply, a tin can telephone is two empty soup cans attached to each other with a string. To use it, the string must be stretched tight and then one person speaks while the other person listens. It is important that nothing touches the string so that it can vibrate and transfer sound from one can to the other.
To successfully set up a tin can telephone, Romy and Jules are going to need a clear line of sight between their two bedroom windows. To determine if they can run the string between their rooms, they get out a map that uses simple integer coordinates. Now consider the following three situations:
In these figures, "Romy" is Romy's window (the grid coordinates
Input Specification
The input begins with a line containing four integer coordinates representing the locations of Romy's and Jules' windows. That is, the input
The next line contains a single integer,
The sample input and output, shown below, corresponds to the first "blocked" situation described previously.
Output Specification
For the input data, output a single number identifying the number of buildings that touch or block the line of sight.
Sample Input
0 0 3 3
1
4 1 2 2 2 2 1 1 1
Sample Output
1
Comments
That time you live in a triacontakaidigon shaped building.
I think morse-code is a good way for them :)
Is the view blocked if both people are inside a building?
Is Line2D disabled for this question? The code works in my IDE but returns Compilation error when submitting.
If they have web access, can't they just use email?
This comment is hidden due to too much negative feedback. Show it anyway.
their parents took away their electronics bc they were playing too much minesweeper
This is 2008, they could've just used the house phone.
nah the parents will take away their computers too ;)