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

WA #2
Posted by h1ci 15 Jun 2009 21:59
What is this test. What is my mistake
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n;
    double r, a[128], b[128], P=0;
    scanf("%d%lf", &n, &r);
    for(int i=0; i<n; i++)
    {
            scanf("%lf%lf", &a[i], &b[i]);
            if(i>0) {
                    P+=sqrt((a[i]-a[i-1])*(a[i]-a[i-1])+(b[i]-b[i-1])*(b[i]-b[i-1]));
                    if(n==2) P+=sqrt((a[i]-a[i-1])*(a[i]-a[i-1])+(b[i]-b[i-1])*(b[i]-b[i-1]));
                    }
            if(i==n-1) P+=sqrt((a[i]-a[0])*(a[i]-a[0])+(b[i]-b[0])*(b[i]-b[0]));
    }
    P+=2*r*acos(-1.0);
    printf("%4.2lf\n", P);
}

Re: WA #2 - I saw my mistake AC now
Posted by h1ci 15 Jun 2009 23:04
how to do it for 0,001 seconds????