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

125 MS,请问怎样才能减少到 60 MS 以内?

Posted by danuno at 2014-08-31 15:43:39 on Problem 1852
#include <cstdio>
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))

int main()
{
    int Cs, L, n, i, j, tmp;
    int min_t, max_t;
    scanf("%d", &Cs);
    for( i = 0; i < Cs; i++){
        scanf("%d %d", &L, &n);
            min_t = 0;
            max_t = 0;
            for(j = 0; i < n; i++)
            {
                scanf("%d", &tmp);
                min_t = max(min_t, min(tmp, L - tmp));
                max_t = max(max_t, max(tmp, L - tmp));
            }
        printf("%d %d\n", min_t, max_t);
    }
}

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