Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef long double ld;
- typedef pair<int,int> pii;
- typedef pair<ll,ll> pll;
- ifstream fin("cern.in");
- ofstream fout("cern.out");
- ll cerc,grad,s,k,lg;
- vector<pll> drum;
- char p;
- int main()
- {
- ios_base::sync_with_stdio(false);
- fin.tie(0);
- fout.tie(0);
- fin>>p>>s>>k;
- if(p=='A')
- {
- cerc=1;
- grad=0;
- }
- if(p=='B')
- {
- cerc=1;
- grad=60;
- }
- if(p=='C')
- {
- cerc=2;
- grad=120;
- }
- if(p=='D')
- {
- cerc=2;
- grad=180;
- }
- if(p=='E')
- {
- cerc=3;
- grad=240;
- }
- if(p=='F')
- {
- cerc=3;
- grad=300;
- }
- drum.push_back({cerc,grad});
- while(true)
- {
- grad+=s;
- if(grad<0)
- grad+=360;
- grad%=360;
- if(cerc==1)
- {
- if(grad==180)
- {
- cerc=2;
- s*=-1;
- grad=0;
- }
- else if(grad==240)
- {
- cerc=3;
- s*=-1;
- grad=60;
- }
- }
- else if(cerc==2)
- {
- if(grad==0)
- {
- cerc=1;
- s*=-1;
- grad=180;
- }
- else if(grad==300)
- {
- cerc=3;
- s*=-1;
- grad=120;
- }
- }
- else if(cerc==3)
- {
- if(grad==120)
- {
- cerc=2;
- s*=-1;
- grad=300;
- }
- else if(grad==60)
- {
- cerc=1;
- s*=-1;
- grad=240;
- }
- }
- if(cerc==drum[0].first&&grad==drum[0].second)
- break;
- drum.push_back({cerc,grad});
- }
- lg=drum.size();
- k%=lg;
- fout<<drum[k].second<<" "<<drum[k].first;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement