ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1020. Rope

Please 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!
Posted by AlexandrPlusnin 24 Aug 2011 16:40
R should be a double type, not integer.