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 |
Re:ri tnndIn Reply To:ri tnnd Posted by:rhna at 2004-10-17 18:12:47 ri tnnd.... > 这道题只要依次按每个桥把坐标对折一下就可以了.... > > > > res = -1; > memset(delta, -1, sizeof(delta)); > delta[X[0]] = 0; > for(i = 1; i < n; ++i) { > int p = X[i] - (int)(sqrt((double)Y[i] * Y[i] - (double)(Y[i] - Y[0]) * (Y[i] - Y[0])) + 1e-12); > if(p < 0) p = 0; > for(j = p; j < X[i]; ++j) { > if(delta[j] == -1) continue; > j1 = 2 * X[i] - j; > if(j1 < X[n - 1]) { > if(delta[j1] == -1 || delta[j] + 1 < delta[j1]) > delta[j1] = delta[j] + 1; > } else { > if(res == -1 || delta[j] + 1 < res) > res = delta[j] + 1; > } > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator