Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace cinema
- {
- class MainClass
- {
- public static Boolean Inside (double [,] data){
- if ((data[2,0]<data[1,0])&&(data[2,0]>data[0,0])&&(data[2,1]<data[1,1])&&(data[2,1]>data[0,1])) {
- return(true);
- } else {
- return(false);
- }
- }
- public static Boolean Border (double [,] c){
- Boolean left = ((c [2, 0] == c [0, 0]) && (c [2, 1] <= c [1, 1]) && (c [2, 1] >= c [0, 1]));
- Boolean Right = ((c [2, 0] == c [1, 0]) && (c [2, 1] <= c [1, 1]) && (c [2, 1] >= c [0, 1]));
- Boolean Top = ((c [2, 1] == c [1, 1]) && (c [2, 0] <= c [1, 0]) && (c [2, 0] >= c [0, 0]));
- Boolean Bottom = ((c [2, 1] == c [0, 1]) && (c [2, 0] <= c [1, 0]) && (c [2, 0] >= c [0, 0]));
- if (left || Right || Top || Bottom) {
- return(true);
- } else {
- return(false);
- }
- }
- public static void Main (string[] args)
- {
- var h = double.Parse(Console.ReadLine ());
- var x = double.Parse(Console.ReadLine ());
- var y = double.Parse(Console.ReadLine ());
- double[,] coords = new double[3, 2] { { 0.0, 0.0 }, { 3.0 * h, h }, { x, y } };
- Boolean horizontal = Inside (coords);
- Boolean hborder = Border (coords);
- coords = new double[3, 2] {{ h, h }, { 2.0 * h, 4.0 * h }, { x, y } };
- Boolean Vertical = Inside(coords);
- Boolean vborder = Border (coords);
- if ((horizontal||Vertical)||(y==h&&x>h&&x<(2*h))) {
- Console.WriteLine ("inside");
- } else if (hborder||vborder) {
- Console.WriteLine ("border");
- } else {
- Console.WriteLine ("outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment