标签:
#include <iostream> #include <iomanip> #define MAXN 1000 using namespace std; struct node { double x; double y; }; node _node[MAXN]; double fun(double a,double b); int main() { //freopen("acm.acm","r",stdin); int n; int i; double tem_x; double tem_y; double x; double y; int sum; while(cin>>n) { tem_x = 0; tem_y = 0; for(i = 0; i < n; ++ i) { cin>>_node[i].x; cin>>_node[i].y; } for(i = 0; i < n-1; ++ i) { if(i % 2 == 0) { tem_x -= _node[i].x; tem_y -= _node[i].y; } else { tem_x += _node[i].x; tem_y += _node[i].y; } } tem_x *= 2; tem_y *= 2; x = fun(_node[n-1].x*2,-tem_x); y = fun(_node[n-1].y*2,-tem_y); cout<<n<<" "; cout<<setiosflags(ios::fixed)<<setprecision(6)<<x<<" "<<y<<" "; x = _node[0].x*2 - x; y = _node[0].y*2 - y; for(i = 1; i < n; ++ i) { cout<<setiosflags(ios::fixed)<<setprecision(6)<<x<<" "<<y<<" "; x = _node[i].x*2 - x; y = _node[i].y*2 - y; } cout<<endl; } } double fun(double a,double b) { return (a+b)/2.0; }
标签:
原文地址:http://www.cnblogs.com/gavinsp/p/4566583.html