Stream: New Blog Post: Lions and tigers, and Pythons and Rabbits, oh my! http://bit.ly/bef5Ga Jobs: We're Hiring! >>
ReignDesign

Jobs - Technical Problems

Please provide the answer to one of the following problems when applying for a position at ReignDesign. All questions regarding these problems can be sent to info@reigndesign.com. Good luck and happy coding!

Easy: Fizz Buzz

Implement a children's game
Show Problem

Problem

In the game FIZZBUZZ, players count numbers 1,2,3,4... Write a program in your preferred programming language which prints out the numbers from 1 to 1000. If a number contains a digit 5, or is divisible by 5, "FIZZ" should be printed instead. If a number contains a digit 7, or is divisible by 7, "BUZZ" should be printed instead. If both of the conditions hold, "FIZZBUZZ" should be printed. You should include the source code with your application.

Output

The first 10 lines of output would be:

				1
				2
				3
				4
				FIZZ
				6
				BUZZ
				8
				9
				FIZZ
				

Hard: Fly Swatter

What are your chances of hitting a fly with a tennis racquet?
Show Problem

Problem

To start with, ignore the racquet's handle. Assume the racquet is a perfect ring, of outer radius R and thickness t (so the inner radius of the ring is R-t).
The ring is covered with horizontal and vertical strings. Each string is a cylinder of radius r. Each string is a chord of the ring (a straight line connecting two points of the circle). There is a gap of length g between neighbouring strings. The strings are symmetric with respect to the center of the racquet i.e. there is a pair of strings whose centers meet at the center of the ring.
The fly is a sphere of radius f. Assume that the racquet is moving in a straight line perpendicular to the plane of the ring. Assume also that the fly's center is inside the outer radius of the racquet and is equally likely to be anywhere within that radius. Any overlap between the fly and the racquet (the ring or a string) counts as a hit.

Input

One line containing an integer N, the number of test cases in the input file.
The next N lines will each contain the numbers f, R, t, r and g separated by exactly one space. Also the numbers will have at most 6 digits after the decimal point.

Output

N lines, each of the form "Case #k: P", where k is the number of the test case and P is the probability of hitting the fly with a piece of the racquet.
Answers with a relative or absolute error of at most 10-6 will be considered correct.

Limits

f, R, t, r and g will be positive and smaller or equal to 10000.
t < R
f < R
r < R
1 < N < 30

Sample

Dowloads:
Sample Input
Sample Output

Input Output
5 Case #1: 1.000000
0.25 1.0 0.1 0.01 0.5 Case #2: 0.910015
0.25 1.0 0.1 0.01 0.9 Case #3: 0.000000
0.00001 10000 0.00001 0.00001 1000 Case #4: 0.002371
0.4 10000 0.00001 0.00001 700 Case #5: 0.573972
1 100 1 1 10