Advertisement
Ronka

Untitled

Jun 21st, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 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 ConsoleApp3
  8. {
  9. class Program
  10. {
  11. class Circle
  12. {
  13. public double X { get; set; }
  14. public double Y { get; set; }
  15. public double Radius { get; set; }
  16. }
  17.  
  18. static bool IsInside(Circle c1, Circle c2)
  19. {
  20. var deltaX = Math.Abs(c1.X - c2.X);
  21. var deltaY = Math.Abs(c1.Y - c2.Y);
  22. double d = Math.Sqrt(Math.Pow(deltaX,2) + Math.Pow(deltaY,2));
  23. double sumRadiuses = c1.Radius + c2.Radius;
  24.  
  25. if (d > sumRadiuses) // ???
  26. {
  27. return false;
  28. }
  29. return true;
  30. }
  31.  
  32. static void Main(string[] args)
  33. {
  34. double[] coordinates1 = Console.ReadLine().Split().Select(double.Parse).ToArray();
  35. double[] coordinates2 = Console.ReadLine().Split().Select(double.Parse).ToArray();
  36.  
  37. Circle first = new Circle();
  38. Circle second = new Circle();
  39.  
  40. first.X = coordinates1[0];
  41. first.Y = coordinates1[1];
  42. first.Radius = coordinates1[2];
  43.  
  44. second.X = coordinates2[0];
  45. second.Y = coordinates2[1];
  46. second.Radius = coordinates2[2];
  47.  
  48. if (IsInside(first,second))
  49. {
  50. Console.WriteLine("Yes");
  51. }
  52. else
  53. {
  54. Console.WriteLine("No");
  55. }
  56.  
  57.  
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement