Advertisement
a53

cern

a53
Aug 29th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef long long ll;
  5. typedef long double ld;
  6. typedef pair<int,int> pii;
  7. typedef pair<ll,ll> pll;
  8. ifstream fin("cern.in");
  9. ofstream fout("cern.out");
  10. ll cerc,grad,s,k,lg;
  11. vector<pll> drum;
  12. char p;
  13. int main()
  14. {
  15. ios_base::sync_with_stdio(false);
  16. fin.tie(0);
  17. fout.tie(0);
  18. fin>>p>>s>>k;
  19. if(p=='A')
  20. {
  21. cerc=1;
  22. grad=0;
  23. }
  24. if(p=='B')
  25. {
  26. cerc=1;
  27. grad=60;
  28. }
  29. if(p=='C')
  30. {
  31. cerc=2;
  32. grad=120;
  33. }
  34. if(p=='D')
  35. {
  36. cerc=2;
  37. grad=180;
  38. }
  39. if(p=='E')
  40. {
  41. cerc=3;
  42. grad=240;
  43. }
  44. if(p=='F')
  45. {
  46. cerc=3;
  47. grad=300;
  48. }
  49. drum.push_back({cerc,grad});
  50. while(true)
  51. {
  52. grad+=s;
  53. if(grad<0)
  54. grad+=360;
  55. grad%=360;
  56. if(cerc==1)
  57. {
  58. if(grad==180)
  59. {
  60. cerc=2;
  61. s*=-1;
  62. grad=0;
  63. }
  64. else if(grad==240)
  65. {
  66. cerc=3;
  67. s*=-1;
  68. grad=60;
  69. }
  70. }
  71. else if(cerc==2)
  72. {
  73. if(grad==0)
  74. {
  75. cerc=1;
  76. s*=-1;
  77. grad=180;
  78. }
  79. else if(grad==300)
  80. {
  81. cerc=3;
  82. s*=-1;
  83. grad=120;
  84. }
  85. }
  86. else if(cerc==3)
  87. {
  88. if(grad==120)
  89. {
  90. cerc=2;
  91. s*=-1;
  92. grad=300;
  93. }
  94. else if(grad==60)
  95. {
  96. cerc=1;
  97. s*=-1;
  98. grad=240;
  99. }
  100. }
  101. if(cerc==drum[0].first&&grad==drum[0].second)
  102. break;
  103. drum.push_back({cerc,grad});
  104. }
  105. lg=drum.size();
  106. k%=lg;
  107. fout<<drum[k].second<<" "<<drum[k].first;
  108. return 0;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement