标签:des style blog http color io os java ar
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 194 Accepted Submission(s): 101
Special Judge
#include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <iostream> #include <vector> #include <queue> #include <stack> #include <cmath> using namespace std; #define PI acos(-1) main() { double stx, sty, endx, endy, x, y, p, endp, xx, yy; int t, n, i, j, k; cin>>t; while(t--){ cin>>n; stx=sty=xx=yy=endp=0;//(stx,sty)是虚拟起点,(endx,endy)是虚拟终点 while(n--){ scanf("%lf %lf %lf",&x,&y,&p); endp+=p; if(endp>=2*PI) endp-=2*PI; endx=(xx-x)*cos(p)-(yy-y)*sin(p)+x; endy=(xx-x)*sin(p)+(yy-y)*cos(p)+y; xx=endx;yy=endy; } //再把虚拟起点和虚拟终点代入上面公式中化简就得出下面很长。。很长。。的式子了 x=((endx-stx*cos(endp)+sty*sin(endp))*(1-cos(endp))-(endy-stx*sin(endp)-sty*cos(endp))*sin(endp))/(2-2*cos(endp)); y=((endx-stx*cos(endp)+sty*sin(endp))*(1-cos(endp))-(1-cos(endp))*(1-cos(endp))*x)/((1-cos(endp))*sin(endp)); printf("%.10lf %.10lf %.10lf\n",x,y,endp); } }
标签:des style blog http color io os java ar
原文地址:http://www.cnblogs.com/qq1012662902/p/3970456.html