Results 1 to 1 of 1

Thread: Help with C homework? [+ full rep]

  1. #1

    Ban's Avatar
    Join Date
    Jan 2013
    Thanked 2,554 Times in 810 Posts

    725 Post(s)
    Time Online
    117 d 7 h 49 m
    Avg. Time Online
    1 h 34 m
    Rep Power
    Gamer IDs

    Steam ID: Lebzeit

    Help with C homework? [+ full rep]

    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):

    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.


    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


    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.

    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:
    Last edited by Ban; 08-30-2013 at 10:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts