Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Triangle
- {
- private static double findDistance(int x1, int y1, int x2, int y2) {
- return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
- }
- static void Main(string[] args)
- {
- int Ax = int.Parse(Console.ReadLine());
- int Ay = int.Parse(Console.ReadLine());
- int Bx = int.Parse(Console.ReadLine());
- int By = int.Parse(Console.ReadLine());
- int Cx = int.Parse(Console.ReadLine());
- int Cy = int.Parse(Console.ReadLine());
- double AB = findDistance(Ax, Ay, Bx, By);
- double AC = findDistance(Ax, Ay, Cx, Cy);
- double BC = findDistance(Bx, By, Cx, Cy);
- if (AB + BC > AC && AB + AC > BC && AC + BC > AB)
- {
- double p = (AB + AC + BC) / 2;
- double area = Math.Sqrt(p * (p - AB) * (p - AC) * (p - BC));
- Console.WriteLine("Yes");
- Console.WriteLine("{0:F2}", area);
- }
- else
- {
- Console.WriteLine("No");
- Console.WriteLine("{0:F2}", AB);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement