Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <vector>
- using namespace std;
- class Point{
- public:
- int x;
- int y;
- Point(int x, int y){
- this->x=x;
- this->y=y;
- }
- int get_x(){
- return x;
- }
- int get_y(){
- return y;
- }
- };
- int simetricx(int x1, int x2 ){
- int x3=2*x2-x1;
- return x3;
- }
- int simetricy(int y1, int y2){
- int y3=2*y2-y1;
- return y3;
- }
- int main(){
- int k;
- cin>>k;
- for(int j=0;j<k;j++){
- int n;
- cin>>n;
- vector<Point>coord;
- if(n%2!=0) cout<<'0'<<"\n";
- else{
- int sumax=0, sumay=0;
- for(int i=0;i<n;i++){
- int x,y;
- cin>>x>>y;
- Point punct(x,y);
- coord.push_back(punct);
- sumax=sumax+x;
- sumay=sumay+y;
- }
- int p=0;
- int Gx,Gy;
- if(sumax==0)Gx=0;
- else Gx=sumax/n;
- if(sumay==0)Gy=0;
- else Gy=sumay/n;
- if(Gx==Gy){
- cout<<'1'<<' ';
- float gx=Gx, gy=Gy;
- printf("%.4f %.4f\n",gx,gy);
- }
- else {
- for(int i=0;i<n-1;i++){
- int Ax,Ay;
- Ax=simetricx(coord[i].get_x(),Gx);
- Ay=simetricx(coord[i].get_y(),Gy);
- for(int b=i;b<n;b++)
- if(Ax==coord[b].get_x()&&Ay==coord[b].get_y()){
- p++;
- cout<<p<<' ';
- float gx=Gx;
- float gy=Gy;
- printf("%.4f %.4f\n",gx,gy);
- }
- }
- if(p==0) cout<<'0'<<"\n";
- }
- }
- coord.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement