Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
125 MS,请问怎样才能减少到 60 MS 以内?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator