0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 16:58:48 +00:00
OI-codes/problem/P1724/P1724.cpp

24 lines
449 B
C++
Raw Normal View History

#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;
}