Professional Documents
Culture Documents
For thousands of years, turtles have been known to migrate in unusual patterns. These patterns can be attributed
to the turtles’ extreme self-consciousness about the way in which they walk in a single direction only during a
given day. Scientists have observed that the turtles’ migration, lasting X days, consists of day-long excursions
in exclusively one compass direction. As the turtle emerges from his shell the next day, he chooses a new
arbitrary compass direction in which to walk.
Scientists have determined that the turtles only move in one of eight directions:
N, NW, NE, W, E, S, SW, or SE. (North, Northwest, Northeast, West, East, South, Southwest, Southeast).
The scientists want to figure out how successful the migration is based on how far they manage to get from their
starting location. They are studying one turtle in particular, Geoffrey. Given the number of days of migration,
and a compass direction and distance (in the unit of Eastern-Pacific mule paces) for each day, what is the total
migratory displacement (in Eastern-Pacific mule paces, within 10e-9 paces) from Geoffrey’s original starting
point?
Input:
The first line of input will contain the number of days, D. (0<=D<=500)
The following D lines will contain a string representing a direction, followed by a space followed by the
number of paces, P. (0<=P<=500). All directions will be valid and uppercase.
Output:
Output only the answer, on its own line. The answer must be within 10e-9.
A 1080p display contains 1920x1080 pixels in a ratio of 16:9. In general, a TV is described in inches referring
to the diagonal of the screen. So, if the height of the screen is 9 inches and the width is 16 inches, the TV is
described as sqrt(337) inches (roughly 18.36 inches). Assuming that the area of the screen is completely
comprised of pixels and nothing else, we can determine the area of a pixel if we have the diagonal.
If the diagonal is sqrt(337) inches, then we know that the width and height are 16 and 9 inches, respectively.
This means the area is 144 sq inches. Therefore a pixel requires 6.94444e-05 square inches.
You will be given the square of the diagonal. Output the area of a pixel.
Input:
The first line of input will contain the square of the diagonal, D. (10<=D<=10000)
Output:
Output only the answer, on its own line. The answer must be within 10e-9.
Jason is trying to sell his inventory of paper. He has two kinds of paper in stock: small paper (sp), and green
paper (gp). Jason’s customers are very cautious about giving out their names, so they use crazy pseudonyms to
order the paper. He has an order sheet of customer names, quantities, and paper types.
Green paper costs 10 times as much as small paper and Jason only records his own costs in terms of gp. For
example, an order of 5 small paper would be recorded as 0.5 gp.
Given the order sheet, determine the cost, in terms of gp, to fulfill all of the orders.
Input:
The first line of input will contain the number of orders, N. (0<=N<=500)
Each of the following N lines are as follows:
<name> <quantity> <paper type (sp or gp)> Each field is separated by a single blank space.
The customer names can be any length, with each part of their name separated by a single blank space, such as
“Jason Loew” or “MC Hammer III”.
Output:
The total cost, in terms of gp (just the number) to fulfill the order.
A sequence can be defined in many different ways, we’ll look at one way here:
X0 = A
X1 = B
X2 = (C*X0 + D*X1)%E
XN = (C*XN-2 + D*XN-1)%E
Input:
The first line will contain the integers, A, B, C, D, E and F in order with a single space between them.
(0<=A,B,C,D<=1000), (2<=E<=20,000,000), (0<=F<=250,000,000)
Output:
Only output the answer on a single line.
When sitting in class, it is obvious that some students simply ruin the experience for everyone. Some are
distracting, some smell funny, some are simply annoying. Over the years you have been able to come up with a
quality rating for students that ranges from (0.0,1.0] with 1.0 being the best. However, this rating isn’t enough
alone. Distance from a seat to a student determines how powerful of an effect they have at damaging the value
of a seat. A seat’s value, lower is better, is the sum of all student influences.
Influence of a student = (1.0/(student quality)) * (max distance two seats can be apart) / (distance between the
student and a seat)
The classroom can be considered a grid of X rows and Y columns where the distance between two adjacent
seats is 1. In a classroom with 4 rows and 5 columns, the maximum distance is the distance from seat[0][0] to
seat[3][4] which is 5.
When you get to class you must find the best empty seat (where lowest seat value determines the best seat).
Output the value of the Beat Seat.
Input
The first line contains X and Y (rows and columns). (1<=X,Y<=100)
On the following X lines there are Y values. These values are:
“E” Empty Seat (There is guaranteed to be at least 1 in any input set)
“X” No seat (You can’t sit here but no one else can either)
<float> Quality value ranging from (0.001 -> 1.000 in increments of 0.001)
Output
Output only the value of the Best Seat on its own line. The answer must be within 10e-9.
In the land of Dorkmor, the currency is the Dorkmid. The Dorkmid is a great currency since a Dorkmid can be
broken into two equal halves each representing half of the prior value. Therefore, from 1 Dorkmid any value in
the form of 1/2X can be obtained. Eventually Dorkmids get too small to be practical, so, practical use rarely
breaks them up more than 80 times.
The Royal Bank of Dorkmoria has a problem. They have Dorkmids to loan out at various interest rates and
monthly payments schedules but they do not know how to determine the payments required to pay off the loan
in the time they permit.
Given an interest rate (yearly rate, there are 12 monthly periods of equal length and interest is compounded), a
starting balance and a number of months, determine the monthly payment that allows the balance to be paid off
in the specified time period. Payments are made at the end of the month. So, interest is added based on the
starting balance.
Input:
The input consists of a single line with 3 values separated by a single space
The first value is the interest rate, I. (0.00<=I<=100, in increments of 0.01)
The second value is the starting balance, B. (0<=B<=2000000)
The third value is the number of moths, M. (1<=M<=720)
Output:
Output the monthly payment on a single line. The answer must be within 10e-9. It must also use less than 80
bits of precision.
Eddie the Awesome was recently injured in a violent chess accident and was forced to compete in the annual
archery tournament with a strained muscle in his back. The contest required competitors to shoot an apple that
sits on the head of a mannequin that happens to be at the same height as Eddie the Awesome’s arrow. Once
Eddie the Awesome got ready to shoot, his back acted up and he became unable to readjust the angle at which
he was aiming.
Eddie the Awesome knows that he can still hit the target if he applies the right amount of force to launch the
arrow. This is since he only cares about the horizontal distance that the arrow travels.
Given the horizontal distance to the target and the angle the arrow is pointed above the horizon, determine the
force necessary to project the arrow onto the target. Use 9.8m/s as the effect of gravity on the arrow.
Input:
The input consists of two values on a single line separated by a single space.
The first value is the angle, A. A ranges from [1,89] degrees. However, it is given in radians.
The second value is the horizontal distance in meters (floating point), D. (0<=D<=250000)
Output:
The output should be the initial velocity of the arrow as Eddie the Awesome shoots it on a single line. The
answer must be within 10e-9.