Advertisement
Guest User

01. Inside the Building

a guest
Apr 14th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Numerics;
  6. using System.Threading.Tasks;
  7. //Ako nqkoi e reshil da gleda tova reshenie, mu pojelavam uspeh!
  8. //Po glupav nachin se sumnqvam da e izmislqn v istoriqta ;)
  9. class Program
  10. {
  11.     static void Main()
  12.     {
  13.         int h  = int.Parse(Console.ReadLine());
  14.         int x1 = int.Parse(Console.ReadLine());
  15.         int y1 = int.Parse(Console.ReadLine());
  16.         int x2 = int.Parse(Console.ReadLine());
  17.         int y2 = int.Parse(Console.ReadLine());
  18.         int x3 = int.Parse(Console.ReadLine());
  19.         int y3 = int.Parse(Console.ReadLine());
  20.         int x4 = int.Parse(Console.ReadLine());
  21.         int y4 = int.Parse(Console.ReadLine());
  22.         int x5 = int.Parse(Console.ReadLine());
  23.         int y5 = int.Parse(Console.ReadLine());
  24.         if(h<0)
  25.         {
  26.             h = Math.Abs(h);
  27.             if(x1 <0)
  28.             {
  29.                 x1 = Math.Abs(x1);
  30.             }
  31.             else if(x1>0)
  32.             {
  33.                 x1 = -x1;
  34.             }
  35.             if (x2 < 0)
  36.             {
  37.                 x2 = Math.Abs(x2);
  38.             }
  39.             else if (x2 > 0)
  40.             {
  41.                 x2 = -x2;
  42.             }
  43.             if (x3 < 0)
  44.             {
  45.                 x2 = Math.Abs(x3);
  46.             }
  47.             else if (x3 > 0)
  48.             {
  49.                 x3 = -x3;
  50.             }
  51.             if (x4 < 0)
  52.             {
  53.                 x4 = Math.Abs(x4);
  54.             }
  55.             else if (x4 > 0)
  56.             {
  57.                 x4 = -x4;
  58.             }
  59.             if (x5 < 0)
  60.             {
  61.                 x5 = Math.Abs(x5);
  62.             }
  63.             else if (x5 > 0)
  64.             {
  65.                 x5 = -x5;
  66.             }
  67.             if (y1 < 0)
  68.             {
  69.                 y1 = Math.Abs(y1);
  70.             }
  71.             else if (y1 > 0)
  72.             {
  73.                 y1 = -y1;
  74.             }
  75.             if (y2 < 0)
  76.             {
  77.                 y2 = Math.Abs(y2);
  78.             }
  79.             else if (y2 > 0)
  80.             {
  81.                 y2 = -y2;
  82.             }
  83.             if (y3 < 0)
  84.             {
  85.                 y3 = Math.Abs(y3);
  86.             }
  87.             else if (y3 > 0)
  88.             {
  89.                 y3 = -y3;
  90.             }
  91.             if (y4 < 0)
  92.             {
  93.                 y4 = Math.Abs(y4);
  94.             }
  95.             else if (y4 > 0)
  96.             {
  97.                 y4 = -y4;
  98.             }
  99.             if (y5 < 0)
  100.             {
  101.                 y5 = Math.Abs(y5);
  102.             }
  103.             else if (y5 > 0)
  104.             {
  105.                 y5 = -y5;
  106.             }
  107.         }
  108.         if(h>0)
  109.         {
  110.             //Point 1
  111.             if(x1>=0 && x1<=3*h)
  112.             {
  113.                 //left
  114.                 if((x1>=0 && x1<=0+h) && (y1>=0 && y1<=0+h))
  115.                 {
  116.                     Console.WriteLine("inside");
  117.                 }
  118.                 //middle
  119.                 else if((x1>=0+h && x1<=0+2*h) && (y1>=0 && y1<=4*h))
  120.                 {
  121.                     Console.WriteLine("inside");
  122.                 }
  123.                 //left
  124.                 else if((x1>=2*h && x1<=3*h) && (y1>=0 && y1 <=h))
  125.                 {
  126.                     Console.WriteLine("inside");
  127.                 }
  128.                 else
  129.                 {
  130.                     Console.WriteLine("outside");
  131.                 }
  132.             }
  133.             else
  134.             {
  135.                 Console.WriteLine("outside");
  136.             }
  137.             if (x2 >= 0 && x2 <= 3 * h)
  138.             {
  139.                 //left
  140.                 if ((x2 >= 0 && x2 <= 0 + h) && (y2 >= 0 && y2 <= 0 + h))
  141.                 {
  142.                     Console.WriteLine("inside");
  143.                 }
  144.                 //middle
  145.                 else if ((x2 >= 0 + h && x2 <= 0 + 2 * h) && (y2 >= 0 && y2 <= 4 * h))
  146.                 {
  147.                     Console.WriteLine("inside");
  148.                 }
  149.                 //left
  150.                 else if ((x2 >= 2 * h && x2 <= 3 * h) && (y2 >= 0 && y2 <= h))
  151.                 {
  152.                     Console.WriteLine("inside");
  153.                 }
  154.                 else
  155.                 {
  156.                     Console.WriteLine("outside");
  157.                 }
  158.             }
  159.             else
  160.             {
  161.                 Console.WriteLine("outside");
  162.             }
  163.             if (x3 >= 0 && x3 <= 3 * h)
  164.             {
  165.                 //left
  166.                 if ((x3 >= 0 && x3 <= 0 + h) && (y3 >= 0 && y3 <= 0 + h))
  167.                 {
  168.                     Console.WriteLine("inside");
  169.                 }
  170.                 //middle
  171.                 else if ((x3 >= 0 + h && x3 <= 0 + 2 * h) && (y3 >= 0 && y3 <= 4 * h))
  172.                 {
  173.                     Console.WriteLine("inside");
  174.                 }
  175.                 //left
  176.                 else if ((x3 >= 2 * h && x3 <= 3 * h) && (y3 >= 0 && y3 <= h))
  177.                 {
  178.                     Console.WriteLine("inside");
  179.                 }
  180.                 else
  181.                 {
  182.                     Console.WriteLine("outside");
  183.                 }
  184.             }
  185.             else
  186.             {
  187.                 Console.WriteLine("outside");
  188.             }
  189.             if (x4 >= 0 && x4 <= 3 * h)
  190.             {
  191.                 //left
  192.                 if ((x4 >= 0 && x4 <= 0 + h) && (y4 >= 0 && y4 <= 0 + h))
  193.                 {
  194.                     Console.WriteLine("inside");
  195.                 }
  196.                 //middle
  197.                 else if ((x4 >= 0 + h && x4 <= 0 + 2 * h) && (y4 >= 0 && y4 <= 4 * h))
  198.                 {
  199.                     Console.WriteLine("inside");
  200.                 }
  201.                 //left
  202.                 else if ((x4 >= 2 * h && x4 <= 3 * h) && (y4 >= 0 && y4 <= h))
  203.                 {
  204.                     Console.WriteLine("inside");
  205.                 }
  206.                 else
  207.                 {
  208.                     Console.WriteLine("outside");
  209.                 }
  210.             }
  211.             else
  212.             {
  213.                 Console.WriteLine("outside");
  214.             }
  215.             if (x5 >= 0 && x5 <= 3 * h)
  216.             {
  217.                 //left
  218.                 if ((x5 >= 0 && x5 <= 0 + h) && (y5 >= 0 && y5 <= 0 + h))
  219.                 {
  220.                     Console.WriteLine("inside");
  221.                 }
  222.                 //middle
  223.                 else if ((x5 >= 0 + h && x5 <= 0 + 2 * h) && (y5 >= 0 && y5 <= 4 * h))
  224.                 {
  225.                     Console.WriteLine("inside");
  226.                 }
  227.                 //left
  228.                 else if ((x5 >= 2 * h && x5 <= 3 * h) && (y5 >= 0 && y5 <= h))
  229.                 {
  230.                     Console.WriteLine("inside");
  231.                 }
  232.                 else
  233.                 {
  234.                     Console.WriteLine("outside");
  235.                 }
  236.             }
  237.             else
  238.             {
  239.                 Console.WriteLine("outside");
  240.             }
  241.         }
  242.  
  243.     }
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement