Advertisement
4valeri

Take_the_plane_down

Feb 17th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 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 Problem_2___Take_the_plane_down
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             long headquarterX = long.Parse(Console.ReadLine());
  14.             long headquarterY = long.Parse(Console.ReadLine());
  15.             long distance = long.Parse(Console.ReadLine());
  16.             long planesNumbers = long.Parse(Console.ReadLine());
  17.  
  18.             for (long i = 0; i < planesNumbers; i++)
  19.             {
  20.                 long planeX = long.Parse(Console.ReadLine());
  21.                 long planeY = long.Parse(Console.ReadLine());
  22.  
  23.                 long distanceX = headquarterX - planeX;
  24.                 long distanceY = headquarterY - planeY;
  25.  
  26.                 double c = Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY));
  27.  
  28.                 if (c <= distance)
  29.                 {
  30.                     Console.WriteLine("You destroyed a plane at [{0},{1}]", planeX, planeY);
  31.                 }
  32.  
  33.  
  34.             }
  35.  
  36.  
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement