Nguyễn Trung Tuyến • 10 tháng trước
using namespace std;
double distance(int x1, int y1, int x2, int y2) {
return sqrt((x1 - x2) * (x1 - x2) * 1. + (y1 - y2) * (y1 - y2));
}
vector cal(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
vector<double> temp;
double d12 = distance(x1, y1, x2, y2),
d23 = distance(x2, y2, x3, y3),
d34 = distance(x3, y3, x4, y4),
d41 = distance(x4, y4, x1, y1),
d13 = distance(x1, y1, x3, y3),
d24 = distance(x2, y2, x4, y4);
temp.push_back(d12);
temp.push_back(d23);
temp.push_back(d34);
temp.push_back(d41);
temp.push_back(d13);
temp.push_back(d24);
sort(temp.begin(), temp.end());
return temp;
}
int main() {
int x1, y1, x2, y2, x3, y3, x4, y4;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
vector<double> vec = cal(x1, y1, x2, y2, x3, y3, x4, y4);
int a1, b1, a2, b2, a3, b3, a4, b4;
int T; cin >> T;
int cnt = 0;
while (T--) {
cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3 >> a4 >> b4;
vector<double> temp = cal(a1, b1, a2, b2, a3, b3, a4, b4);
if (temp == vec) cnt++;
}
cout << cnt;
return 0;
}
Bình luận: