IT Marathon 2011> Competitors > IT Contest > Problem Samples > Programming
All problems will be given to the contestants following precisely the same format shown below:
Develop a program that, given as input the Cartesian coordinates of three vertices of a rectangle, reports the area of that rectangle. You will recall that the area of a rectangle is the product of the lengths of any two adjacent sides.
The first line contains a positive integer n indicating how many rectangles are to be analyzed. Each rectangle is described on a single line via six real numbers, x1, y1, x2, y2, x3, and y3, separated by spaces. These provide the coordinates of three of the rectangle’s vertices, namely P1(x1, y1), P2(x2, y2), and P3(x3, y3).
For each rectangle provided as input, report its area.
3
0.0 0.0 0.0 1.0 1.0 0.0
-1.0 2.0 3.0 5.0 1.0 1.0
5.0 9.0 -0.5 0.0 7.5 5.0
Area of rectangle with vertices (0.0,0.0),(0.0,1.0),(1.0,0.0) is 1.0
Area of rectangle with vertices (-1.0,2.0),(3.0,5.0),(1.0,1.0) is 10.0
Area of rectangle with vertices (5.0,9.0),(-0.5,0.0),(7.5,5.0) is 44.5
Develop a program to create a calendar for one month. Your program will accept two inputs. The first input is the number of the month for which you will create the calendar. January is represented by 1, February by 2, and so on. The second input is the year for which you will create the calendar. The year is any positive integer between 1500 and 9999, inclusive. Your program should display a calendar representing that month, in the same form as shown in the example below. Your program should accept input and provide output until the user enters 0 as the month.
For our purposes, you are to assume that any year divisible by 4 is a leap year and that the Gregorian calendar applies all the way back to the year 1500. In the output, it is not necessary for the month name and year (March, 2012 in the example below) to be centered exactly above your calendar, but it should appear above the calendar. It may be helpful to note that January 1, 1500, was a Thursday and that the number of days in each month is as follows: January, March, May, July, August, October, and December each have 31; April, June, September, and November each have 30; February has 28 in non-leap years and 29 in leap years.
Enter Month: 3
Enter Year: 2012
March, 2012
S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Enter Month: 0