0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 02:45:24 +00:00

P1724 东风谷早苗 [60' Code]

R39033232
This commit is contained in:
Baoshuo Ren 2020-09-29 21:49:03 +08:00 committed by Baoshuo Ren
parent 24420a36f5
commit 6acdcd5083
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

23
problem/P1724/P1724.cpp Normal file
View File

@ -0,0 +1,23 @@
#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;
}