|
|
back to boardDiscussion of Problem 1020. RopePlease Help Me,,,, Error: Crash! on test4! Posted by Azamat 21 Aug 2011 11:29 using System; class Program { private static void Main() { string[] s = Console.ReadLine().Split(' '); int n = int.Parse(s[0]), r = int.Parse(s[1]); double S_Ay = System.Math.PI * r * 2; string[] s2 = Console.ReadLine().Split(' '); double a1 = double.Parse(s2[0]); double b1 = double.Parse(s2[1]); if (n > 1) { double aa = a1; double bb = b1; for (int i = 2; i <= n; i++) { string[] s3 = Console.ReadLine().Split(' '); double a2 = double.Parse(s3[0]); double b2 = double.Parse(s3[1]); S_Ay += System.Math.Sqrt(System.Math.Pow(a2 - a1, 2) + System.Math.Pow(b2 - b1, 2)); a1 = a2; b1 = b2; } S_Ay += System.Math.Sqrt(System.Math.Pow(a1 - aa, 2) + System.Math.Pow(b1 - bb, 2)); } Console.WriteLine("{0:F2}",S_Ay); } } Edited by author 21.08.2011 11:30 Re: Please Help Me,,,, Error: Crash! on test4! R should be a double type, not integer. |
|
|