fork download
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. Double a = Double.Parse(Console.ReadLine());
  8. Double b = Double.Parse(Console.ReadLine());
  9. Double c = Double.Parse(Console.ReadLine());
  10. Double d = Double.Parse(Console.ReadLine());
  11. var s = (a + b + c + d)/2;
  12.  
  13. if (a > b) Swap(ref a, ref b);
  14.  
  15. if (b > c) Swap(ref b, ref c);
  16. if (a > c) Swap(ref a, ref c);
  17.  
  18. if (a > d) Swap(ref a, ref d);
  19. if (b > d) Swap(ref b, ref d);
  20. if (c > d) Swap(ref c, ref d);
  21.  
  22. if (s > 0)
  23. {
  24. var mpn = 0.0;
  25. if (a > 0) mpn = a;
  26. else if (b > 0) mpn = b;
  27. else if (c > 0) mpn = c;
  28. else if (d > 0) mpn = d;
  29. else throw new Exception("!!!!!!");
  30. Console.WriteLine(mpn*mpn);
  31.  
  32. }
  33. else
  34. {
  35. if (a < 0) a -= d;
  36. if (b < 0) b -= d;
  37. if (c < 0) c -= d;
  38. if (d < 0) d -= d;
  39. Console.WriteLine(a);
  40. Console.WriteLine(b);
  41. Console.WriteLine(c);
  42. Console.WriteLine(d);
  43. }
  44.  
  45. }
  46.  
  47. private static void Swap(ref double a, ref double b)
  48. {
  49. var tmp = a;
  50. a = b;
  51. b = tmp;
  52. }
  53. }
Success #stdin #stdout 0.05s 23880KB
stdin
5
2
6
1
stdout
1