This commit is contained in:
James 2020-07-22 10:10:42 +08:00
parent 2af004b8d0
commit 6953000304
9 changed files with 129 additions and 0 deletions

3
2807_juxing/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

BIN
2807_juxing/doc/矩形.pdf Normal file

Binary file not shown.

80
2807_juxing/main.cpp Normal file
View File

@ -0,0 +1,80 @@
#include <iostream>
using namespace std;
struct xy {
int x[5], y[5];
} a[2];
int hx(int a, int b)
{
return a < b ? a : b;
}
int hd(int a, int b)
{
return a > b ? a : b;
}
void cfind()
{
for (int i = 1; i <= 4; i++) {
if (a[0].x[i] >= a[1].x[3] && a[0].x[i] <= a[1].x[4]) {
if (a[0].y[i] >= a[1].y[3] && a[0].y[i] <= a[1].y[4]) {
cout << "Y" << endl;
return;
}
}
}
a[1].x[3] = a[1].x[1];
a[1].y[3] = a[1].y[2];
a[1].x[4] = a[1].x[2];
a[1].y[4] = a[1].y[1];
a[0].x[3] = hx(a[0].x[1], a[0].x[2]);
a[0].y[3] = hx(a[0].y[2], a[0].y[1]);
a[0].x[4] = hd(a[0].x[1], a[0].x[2]);
a[0].y[4] = hd(a[0].y[2], a[0].y[1]);
for (int i = 1; i <= 4; i++) {
if (a[1].x[i] >= a[0].x[3] && a[1].x[i] <= a[0].x[4]) {
if (a[1].y[i] >= a[0].y[3] && a[1].y[i] <= a[0].y[4]) {
cout << "Y" << endl;
return;
}
}
}
cout << "N" << endl;
return;
}
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= 2; j++) {
int cx, cy;
cin >> cx >> cy;
a[0].x[j] = cx + 100000;
a[0].y[j] = cy + 100000;
}
a[0].x[3] = a[0].x[1];
a[0].y[3] = a[0].y[2];
a[0].x[4] = a[0].x[2];
a[0].y[4] = a[0].y[1];
for (int j = 1; j <= 2; j++) {
int cx, cy;
cin >> cx >> cy;
a[1].x[j] = cx + 100000;
a[1].y[j] = cy + 100000;
}
a[1].x[3] = hx(a[1].x[1], a[1].x[2]);
a[1].y[3] = hx(a[1].y[2], a[1].y[1]);
a[1].x[4] = hd(a[1].x[1], a[1].x[2]);
a[1].y[4] = hd(a[1].y[2], a[1].y[1]);
// for(int j=1;j<=4;j++){
// cout<<a[0].x[j]<<","<<a[0].y[j]<<endl;
// }
// for(int j=1;j<=4;j++){
// cout<<a[1].x[j]<<","<<a[1].y[j]<<endl;
// }
cfind();
}
return 0;
}

BIN
2807_juxing/main.exe Normal file

Binary file not shown.

3
2807_juxing/test/in.txt Normal file
View File

@ -0,0 +1,3 @@
2
1 1 6 6 4 7 9 2
-1 -1 4 4 1 1 2 2

6
2807_juxing/test/in2.txt Normal file
View File

@ -0,0 +1,6 @@
5
71477 10242 75962 97808 -51719 84770 -24057 -71111
82862 -71566 24935 16323 96922 -20780 37585 -94363
66083 -16416 -96013 -24708 70829 3060 60269 25518
-19043 74452 807 68912 -51897 74823 -13870 -34404
97218 50023 19848 41769 -21715 -44688 62372 91639

6
2807_juxing/test/in3.txt Normal file
View File

@ -0,0 +1,6 @@
5
-68701 -77642 -24308 -95981 -87068 38997 -61304 16257
80136 -73984 -31017 46761 -43215 28021 -73542 45727
16289 14381 -83054 -24610 -10238 15403 19532 -21933
95228 -62011 -6381 51659 -19048 -95222 -52091 -82002
-39644 72117 -8007 -64754 57946 87196 -56253 -25567

30
2807_juxing/test/out.txt Normal file
View File

@ -0,0 +1,30 @@
## z:\Chao\src\2807_juxing\test\in.txt
2020/06/25 ÖÜËÄ 21:38:43.75
Y
Y
-----------------------------------------------
Process exited after 170 ms with return value 0
## z:\Chao\src\2807_juxing\test\in2.txt
2020/06/25 ÖÜËÄ 21:38:43.75
N
Y
N
Y
Y
-----------------------------------------------
Process exited after 100 ms with return value 0
## z:\Chao\src\2807_juxing\test\in3.txt
2020/06/25 ÖÜËÄ 21:38:43.75
N
N
Y
N
Y
-----------------------------------------------
Process exited after 90 ms with return value 0