Advertisement
Ina5

Take the plane down

Apr 18th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TakeThePlaneDown
  8. {
  9.     class TakeThePlaneDown
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int xHead = int.Parse(Console.ReadLine());
  14.             int yHead = int.Parse(Console.ReadLine());
  15.             int distance = int.Parse(Console.ReadLine());
  16.             int planes = int.Parse(Console.ReadLine());
  17.  
  18.           //  List<int> list = new List<int>();
  19.  
  20.             for (int i = 0; i < planes; i++)
  21.             {
  22.                 int xPlane = int.Parse(Console.ReadLine());
  23.                 int yPlane = int.Parse(Console.ReadLine());
  24.  
  25.  
  26.                int re1 =  xHead + distance;
  27.                int re2 =  xHead - distance;
  28.                int re3 = yHead + distance;
  29.                int re4 =  yHead - distance;
  30.  
  31.  
  32.                 if ((xPlane > re2 && xPlane < re1) && (yPlane > re4 && yPlane < re3))
  33.                 {
  34.                    // list.Add(xPlane);
  35.                   //  list.Add(yPlane);
  36.                     Console.WriteLine("You destroyed a plane at [{0},{1}]" , xPlane, yPlane);
  37.                 }
  38.                 else
  39.                 {
  40.                     continue;
  41.                 }
  42.                
  43.             }
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement