Advertisement
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 _02.Take_The_Plane_Down
- {
- class Program
- {
- static void Main(string[] args)
- {
- //• On the first line you will be given the X of your headquarter.
- double headquarterX = double.Parse(Console.ReadLine());
- //• On the second line you will be given the Y of your headquarter.
- double headquarterY = double.Parse(Console.ReadLine());
- //• On the third line you will be given the distance from your headquarter to the borders.
- double distanceToBorder = double.Parse(Console.ReadLine());
- //• On the fourth line you will be given the number of the planes that are approaching
- double numberOfPlanes = double.Parse(Console.ReadLine());
- int counter = 0;
- //On the next 2 * N lines you will be given:
- while (counter < numberOfPlanes)
- {
- //• On the every odd line you will be given the plane X coordinate
- double planeX = double.Parse(Console.ReadLine());
- //• on the every even line you will be given the plane Y coordinate
- double planeY = double.Parse(Console.ReadLine());
- counter++;
- bool isInside = Math.Pow(headquarterX - planeX, 2) + Math.Pow(headquarterY - planeY, 2)
- <= Math.Pow(distanceToBorder, 2);
- if (isInside)
- {
- Console.WriteLine("You destroyed a plane at [{0},{1}]",planeX,planeY);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement