Home > Back-end >  C beginners turn a program content
C beginners turn a program content

Time:10-20

Known a rectangular four vertices, surrounded by a lot of points, know ID coordinates, requirements coverage (coverage refers to the external rectangle) including the points a little extra and increase the area of the minimum part written in the book is not moved to guide for correct
Int find_min_cover (int order, int kx, int ky) {
Int temp=0;
Double add_area=0;
Double add_area_temp=0;
Int ko=ky + 1;
Bool flag_10=true;
While (user_flag [order] [user_y [order] [ko] id] & amp; & Koif(! User_flag [order] [user_y [order] [ko] id]) {
Temp=ko.
If (user_y [order] [ko] xAdd_area=(x_min [order] - user_y [order] [ko]. X) * (user_y [order] [ko] y - y_min [order]) + (x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
Else if (user_y [order] [ko] x> X_max [order]) {
Add_area=(user_y [order] [ko]. X-ray x_max [order]) * (user_y [order] [ko] y - y_min [order]) + (x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
The else {
Flag_10=false;
Add_area=(x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
}
Ko++;
If (flag_10) {
for(int i=0; i<10& & KoIf (user_y [order] [ko] x X_min [order]) {
Add_area_temp=(x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
If (add_area_temp & lt; Add_area) {
Temp=ko.
Add_area=add_area_temp;
}
break;
}
}
}

Ko=ky - 1;
Flag_10=true;
While (user_flag [order]] of [ko & amp; & Ko> Ko - 0);
if(! User_flag [order] [ko]) {
Temp=ko.
If (user_y [order] [ko] xAdd_area_temp=(x_min [order] - user_y [order] [ko]. X) * (y_max [order] - user_y [order] [ko] y) + (x_max [order] - x_min [order]) * (y_min [order] - user_y [order] [ko] y);
}
Else if (user_y [order] [ko] x> X_max [order]) {
Add_area_temp=(user_y [order] [ko]. X-ray x_max [order]) * (y_max [order] - user_y [order] [ko] y) + (x_max [order] - x_min [order]) * (y_min [order] - user_y [order] [ko] y);
}
The else {
Flag_10=false;
Add_area_temp=(x_max [order] - x_min [order]) * (y_min [order] - user_y [order] [ko] y);
}
If (add_area_temp & lt; Add_area) {
Temp=ko.
Add_area=add_area_temp;
}
}
Ko++;
If (flag_10) {
for(int i=0; i<10& & Ko> 0; I++, ko -) {
If (user_y [order] [ko] x X_min [order]) {
Double add_area_temp=(x_max [order] - x_min [order]) * (y_min [order] - user_y [order] [ko] y);
If (add_area_temp & lt; Add_area) {
Temp=ko.
Add_area=add_area_temp;
}
break;
}
}
}

Ko=kx + 1;
Flag_10=true;
While (user_flag [order]] of [ko & amp; & Koif(! User_flag [order] [ko]) {
Temp=ko.
If (user_y [order] [ko] xAdd_area=(x_min [order] - user_y [order] [ko]. X) * (user_y [order] [ko] y - y_min [order]) + (x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
Else if (user_y [order] [ko] x> X_max [order]) {
Add_area=(user_y [order] [ko]. X-ray x_max [order]) * (user_y [order] [ko] y - y_min [order]) + (x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
The else {
Flag_10=false;
Add_area=(x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
}
}
Ko++;
If (flag_10) {
for(int i=0; i<10& & KoIf (user_y [order] [ko] x X_min [order]) {
Add_area_temp=(x_max [order] - x_min [order]) * (user_y [order] [ko] y - y_max [order]);
If (add_area_temp & lt; Add_area) {
Temp=ko.
Add_area=add_area_temp;
}
break;
}
}
}


return temp;
}

CodePudding user response:

No one can help yao ~

CodePudding user response:

No one should be willing to see, the code the same things, see have to cost a lot of time

CodePudding user response:

No application notes, not variable, no format, 3 without the product
  • Related