Advertisement
Nickpips

Untitled

Jan 29th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #define _USE_MATH_DEFINES
  4. #include <math.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. vector<pair<int, int>> pts( 5, pair<int, int>( 1, 0 ) );
  11. int n;
  12. cin >> n;
  13. while( n-- > 0 )
  14. {
  15. int cmd, pt, arg;
  16. cin >> cmd >> pt >> arg;
  17. if( cmd == 1 )
  18. pts[pt-1].first += arg;
  19. else
  20. pts[pt-1].second -= arg;
  21.  
  22. double x = 0, y = 0;
  23. double arg2 = 0;
  24. for( int i = 0; i < 5; i++ )
  25. {
  26. x += pts[i].first * cos( arg2 += pts[i].second * M_PI / 180.0 );
  27. y += pts[i].first * sin( arg2 );
  28. }
  29. cout << "(" << x << ", " << y << ")" << endl;
  30. }
  31.  
  32. system( "PAUSE" );
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement