Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么TLE?

Posted by utwodownson at 2013-03-25 10:30:01 on Problem 1939
/*
 * Time Limit Exceeded
 *
typedef struct _node{
    double x;
    double y;
}Node;
Node a[30000];
int main()
{
    int n = 0;
    double mx;
    double my;
    while (scanf("%d", &n) != EOF)
    {
        for (int i = 0; i < n; ++i)
            scanf("%lf%lf", &a[i].x, &a[i].y);
        a[n].x = a[0].x;
        a[n].y = a[0].y;
        printf("%d", n);
        for (int i = 0; i < n; ++i)
        {
            mx = (a[i].x + a[i + 1].x) / 2.0;
            my = (a[i].y + a[i + 1].y) / 2.0;
            printf(" %.6lf %.6lf", mx, my);
        }
        printf("\n");
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator