A题很水的几何题

套一下向量的旋转公式即可

2017-2-17第一周周赛题解

 

 1 #include<stdio.h>
 2 #include<queue>
 3 #include<math.h>
 4 using namespace std;
 5 const double PI=acos(-1);
 6 struct Node
 7 {
 8     double x,y;
 9     int angel;
10     void rotate()
11     {
12         double t=angel*PI/180,a;
13         a=cos(t)*x-sin(t)*y;
14         y=sin(t)*x+cos(t)*y;
15         x=a;
16     }
17 }vec;
18 int main()
19 {
20     int t,x,n;
21     char op[10];
22     while(scanf("%lf%lf%d",&vec.x,&vec.y,&vec.angel)!=EOF)
23     {
24         vec.rotate();
25         printf("%f %f\n",vec.x,vec.y);
26     }
27     return 0;
28 }
A题代码

相关文章: