PDA

View Full Version : Help with C homework? [+ full rep]



Ban
08-30-2013, 09:10 PM
The CCF (Carbon Cylinders Factory) manufactures various types of carbon cylinders. The CCF is installed on the tenth floor of a building, and uses the building elevators to transport the cylinders. For the sake of safety, the cylinders must be transported in an upright position, as they are heavy, only two cylinders can be transported in a single elevator ride. The elevators are cobblestone shaped and always have a height greater than the height of the cylinders.

To minimize the number of trips to transport the cylinders, the CCF wants, whenever possible, to place two cylinders in the elevator. The images below illustrates, schematically (top view), a case when it is possible (a) and a case where it is not possible (b):

[Only registered and activated users can see links]

As there is a very large amount of elevators and types of cylinders, the CCF wants you to write a program that, given the dimensions of the elevator and of the two cylinders, determine whether it is possible to put the two cylinders in the elevator.

Entry:

The entry contains only one test case. The first and only line of each test case contains four integers L, C, R1 and R2, separated by blanks, indicating respectively the width of the elevator (1 <=
L <= 100), the length of the lift (1 <= C <= 100) and the radius of the cylinders (1 <= R1, R2 <= 100). All data input is

Output:

For the test case, your program must print a single line with a single character: "S" if you can put the two cylinders in the elevator and "N" otherwise.

example
Entry | Output
11 9 2 3 | S
7 8 3 2 | N
10 15 3 7 | N
8 9 3 2 | S


Basically that! You can use whatever command you'd like, as long as you can explain what it means/does c:
:3