Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _14.Point_in_the_Figure
- {
- class Program
- {
- static void Main(string[] args)
- {
- var h = int.Parse(Console.ReadLine());
- var x = int.Parse(Console.ReadLine());
- var y = int.Parse(Console.ReadLine());
- bool onRect1 = ((x == 0 || x == 3 * h) && (y >= 0 && y <= h)) || ((y == 0 || y == h) && (x >= 0 && x <=3 * h));
- bool onRect2 = ((x == h || x == 2 * h) && (y >= h && y <= 4 * h)) || ((y == h || y == 4 * h) && (x >= h && x <= 2*h));
- bool inside = ((x > 0 && x < 3 * h) && (y > 0 && y < h)) || ((x > h && x < 2 * h) && (y > h && y < 4 * h));
- int place = -1;
- if (onRect1 || onRect2)
- {
- place = 0;
- }
- if (y==h&&x>h&&x<2*h)
- {
- place = 1;
- }
- if (inside)
- {
- place = 1;
- }
- switch (place)
- {
- case -1: Console.WriteLine("outside"); break;
- case 0: Console.WriteLine("border");break;
- case 1: Console.WriteLine("inside"); break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment