zh_stoqnov

Triangle

Oct 27th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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 Triangle
  8. {
  9. class Triangle
  10. {
  11. static void Main(string[] args)
  12. {
  13. int ax = int.Parse(Console.ReadLine());
  14. int ay = int.Parse(Console.ReadLine());
  15. int bx = int.Parse(Console.ReadLine());
  16. int by = int.Parse(Console.ReadLine());
  17. int cx = int.Parse(Console.ReadLine());
  18. int cy = int.Parse(Console.ReadLine());
  19. double a = (double)Math.Sqrt(((bx - ax) * (bx - ax)) + ((by - ay) * (by - ay)));
  20. double b = (double)Math.Sqrt(((cx - bx) * (cx - bx)) + ((cy - by) * (cy - by)));
  21. double c = (double)Math.Sqrt(((cx - ax) * (cx - ax)) + ((cy - ay) * (cy - ay)));
  22. double p = (a + b + c) / 2;
  23. double area = Math.Sqrt(p * (p - a) * (p - b) * (p - c));
  24. if (a + b > c && b + c > a && a + c > b)
  25. {
  26. Console.WriteLine("Yes");
  27. Console.WriteLine("{0:0.00}", area);
  28. }
  29. else
  30. {
  31. Console.WriteLine("No");
  32. Console.WriteLine("{0:0.00}", a);
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment