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 |
只保存上一个坐标和第一个坐标就够了,附小代码#define Y scanf("%lf%lf",x+p, y+p) #define Z(k) (k[0]+k[1])/2 int main() { double x[3], y[3]; int n, p; while (scanf("%d", &n) > 0) { printf("%d ", n); p = 0; Y; x[2] = x[0]; y[2] = y[0]; p = 1; while (--n) { Y; printf("%lf %lf ", Z(x), Z(y)); p ^= 1; } x[p] = x[2]; y[p] = y[2]; printf("%lf %lf ", Z(x), Z(y)); putchar(10); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator