- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
for (i=0; i<n; i++){
for (int j=0; j<n; j++){
if (x[i]>x[j] && x[i]-x[j] > zx && (y[i]>y[j] && y[i]-y[j] > zy) || (y[i]<y[j] && y[j]-y[i] > zy)){
zx = x[i] - x[j]; a1=i; a2=j;
if (y[i]>y[j] && y[i]-y[j] > zy && sum < zx + (y[i]-y[j])) zy = y[i] - y[j]; b1=i; b2=j; sum = zx + zy;
if (y[i]<y[j] && y[j]-y[i] > zy && sum < zx + (y[j]-y[i])) zy = y[j] - y[i]; b1=i; b2=j; sum = zx + zy;
}
if (x[i]<x[j] && x[j]-x[i] > zx && (y[i]>y[j] && y[i]-y[j] > zy) || (y[i]<y[j] && y[j]-y[i] > zy)){
zx = x[j] - x[i]; a1=i; a2=j;
if (y[i]>y[j] && y[i]-y[j] > zy && sum < zx + (y[i]-y[j])) zy = y[i] - y[j]; b1=i; b2=j; sum = zx + zy;
if (y[i]<y[j] && y[j]-y[i] > zy && sum < zx + (y[j]-y[i])) zy = y[j] - y[i]; b1=i; b2=j; sum = zx + zy;
}
}
}
нахождение координат двух наиболее отдаленных точек среди заданных=)