Advertisement
NAbdulla

Untitled

Jun 14th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. #define pi acos(-1)
  6.  
  7. int main()
  8. {
  9.     int t, i;
  10.     double x, y, theta, x1, y1;
  11.     scanf("%d", &t);
  12.     for(i = 1; i <= t; i++){
  13.         scanf("%lf %lf %lf", &x, &y, &theta);
  14.         theta = pi*theta/180;
  15.         x1 = x*cos(theta)-y*sin(theta);
  16.         y1 = x*sin(theta)+y*cos(theta);
  17.         if(fabs(x1 - -0.000) < 1e-6)x1 = 0;
  18.         if(fabs(y1 - -0.000) < 1e-6)y1 = 0;
  19.         printf("Case %d: %.3lf %.3lf\n", i, x1, y1);
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement