diff --git a/problem/P1724/P1724.cpp b/problem/P1724/P1724.cpp new file mode 100644 index 00000000..8904433b --- /dev/null +++ b/problem/P1724/P1724.cpp @@ -0,0 +1,23 @@ +#include + +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; +}