Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ExamPreparation
- {
- public sealed class Startu
- {
- public static void Main()
- {
- double[] firstCoordinates = Console.ReadLine()
- .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(double.Parse)
- .ToArray();
- double[] secondCoordinates = Console.ReadLine()
- .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(double.Parse)
- .ToArray();
- Rectangle first = new Rectangle(firstCoordinates[0], firstCoordinates[1], firstCoordinates[2], firstCoordinates[3]);
- Rectangle second = new Rectangle(secondCoordinates[0], secondCoordinates[1], secondCoordinates[2], secondCoordinates[3]);
- bool isInside = first.Left >= second.Left &&
- first.Right <= second.Right &&
- first.Top <= second.Top &&
- first.Bottom <= second.Bottom;
- if (isInside)
- {
- Console.WriteLine("Inside");
- }
- else
- {
- Console.WriteLine("Not inside");
- }
- }
- }
- public sealed class Rectangle
- {
- public Rectangle(double left, double top, double width, double height)
- {
- this.Left = left;
- this.Top = top;
- this.Width = width;
- this.Height = height;
- }
- public double Left { get; private set; }
- public double Top { get; private set; }
- public double Width { get; private set; }
- public double Height { get; private set; }
- public double Right
- {
- get
- {
- return this.Left + this.Width;
- }
- }
- public double Bottom
- {
- get
- {
- return this.Top + this.Height;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment