#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
string tp; cin >> tp;
int x, y; cin >> x >> y; x--, y--;
if(tp == "Algosia") {
if(abs(x-y) != 1 && abs(x-y) != 999) x = (x+1)%1000, y = (y+1)%1000;
else x = (x+2)%1000, y = (y+2)%1000;
cout << x+1 << ' ' << y+1 << endl;
}
else {
if(abs(x-y) != 1 && abs(x-y) != 999) x = (x-1+1000)%1000, y = (y-1+1000)%1000;
else x = (x-2+1000)%1000, y = (y-2+1000)%1000;
cout << x+1 << ' ' << y+1 << endl;
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); string tp; cin >> tp; int x, y; cin >> x >> y; x--, y--; if(tp == "Algosia") { if(abs(x-y) != 1 && abs(x-y) != 999) x = (x+1)%1000, y = (y+1)%1000; else x = (x+2)%1000, y = (y+2)%1000; cout << x+1 << ' ' << y+1 << endl; } else { if(abs(x-y) != 1 && abs(x-y) != 999) x = (x-1+1000)%1000, y = (y-1+1000)%1000; else x = (x-2+1000)%1000, y = (y-2+1000)%1000; cout << x+1 << ' ' << y+1 << endl; } } |
English