0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 18:45:25 +00:00
OI-codes/problem/P1724/P1724.cpp
2020-09-29 21:49:03 +08:00

24 lines
449 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int x = 0, y = 0, t = 0, i = 0;
string s;
cin >> s >> t;
while (t--) {
if (i >= s.size()) {
i = 0;
}
switch (s[i]) {
case 'E': x++; break;
case 'S': y--; break;
case 'W': x--; break;
case 'N': y++; break;
}
i++;
}
cout << x << ' ' << y << endl;
return 0;
}