mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-26 08:52:02 +00:00
28 lines
488 B
C++
28 lines
488 B
C++
|
#include <iostream>
|
||
|
#include <string>
|
||
|
|
||
|
using std::cin;
|
||
|
using std::cout;
|
||
|
const char endl = '\n';
|
||
|
|
||
|
const int mod = 4;
|
||
|
const int to[4][2] = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}};
|
||
|
|
||
|
int n, x, y, d;
|
||
|
std::string s;
|
||
|
|
||
|
int main() {
|
||
|
std::ios::sync_with_stdio(false);
|
||
|
cin >> n >> s;
|
||
|
for (char c : s) {
|
||
|
if (c == 'S') {
|
||
|
x += to[d][0];
|
||
|
y += to[d][1];
|
||
|
} else {
|
||
|
d = ++d % mod;
|
||
|
}
|
||
|
}
|
||
|
cout << x << ' ' << y << endl;
|
||
|
return 0;
|
||
|
}
|