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 mainSolution
- {
- public class MyException : Exception
- {
- public MyException(string messege) : base(message: messege + "\n\n\n Exception founded by Decibit\n\n\n") { }
- public MyException() : base()
- {
- }
- public void Messsage()
- {
- Console.WriteLine("\n\n\n\n\n\n Invalid number, please enter a number from 1 to 10 \n\n\n\n\n\n");
- }
- }
- class Input
- {
- private static IEnumerator<string> getin()
- {
- while (true)
- foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))
- yield return s;
- }
- private IEnumerator<string> inp = getin();
- public string GetString() { inp.MoveNext(); return inp.Current; }
- public int GetInt() { return int.Parse(GetString()); }
- public long GetLong() { return long.Parse(GetString()); }
- public double GetDouble() { return double.Parse(GetString()); }
- }
- static class Program
- {
- static double sqr(double a) => a * a;
- static double length(double x1, double y1, double x2, double y2) => Math.Sqrt(sqr(x1 - x2) + sqr(y1 + y2));
- static int next(int i) => (i + 1)%3;
- static void Main(string[] args)
- {
- double[] x = new double[3];
- double[] y = new double[3];
- Input cin = new Input();
- for (int i = 0; i < 3; i++)
- {
- x[i] = cin.GetDouble();
- y[i] = cin.GetDouble();
- }
- double ans = 0;
- for (int i = 0; i < 3; i++)
- {
- ans += length(x[i], y[i], x[next(i)], y[next(i)]);
- }
- Console.WriteLine(ans);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement