#include <bits/stdc++.h>
using namespace std;
const string ALGOSIA = "Algosia";
const int J = 1;
const int T = 1000;
int main() {
// ifstream cin("dlazaw/par0a.in");
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
string version;
cin >> version;
int a, b;
cin >> a;
cin >> b;
const int diff = abs(a - b);
const int d = (diff == J || diff == T - J) ? 2 : 1;
if (version == ALGOSIA) {
a = a + d;
if (a > T) {
a = a - T;
}
b = b + d;
if (b > T) {
b = b - T;
}
} else {
a = a - d;
if (a < J) {
a = a + T;
}
b = b - d;
if (b < J) {
b = b + T;
}
}
cout << a << " " << b << endl;
cout.flush();
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <bits/stdc++.h> using namespace std; const string ALGOSIA = "Algosia"; const int J = 1; const int T = 1000; int main() { // ifstream cin("dlazaw/par0a.in"); cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false); string version; cin >> version; int a, b; cin >> a; cin >> b; const int diff = abs(a - b); const int d = (diff == J || diff == T - J) ? 2 : 1; if (version == ALGOSIA) { a = a + d; if (a > T) { a = a - T; } b = b + d; if (b > T) { b = b - T; } } else { a = a - d; if (a < J) { a = a + T; } b = b - d; if (b < J) { b = b + T; } } cout << a << " " << b << endl; cout.flush(); } |
English