本蒟蒻下载了测试样例自测没有问题,但在评测机上却爆 0。QAQ
代码:
#include<bits/stdc++.h>
using namespace std;
string a;int t,x,y;
int stx,sty;
void walk(char ch){
if(ch=='E')x++;
if(ch=='S')y--;
if(ch=='W')x--;
if(ch=='N')y++;
}
int main(){
getline(cin,a);cin>>t;
for(int i=0;i<a.size();i++){
walk(a[i]);
if(i==t%(a.size())-1)stx=x,sty=y;
}
int yyy=t/a.size();
cout<<x*yyy+stx<<" "<<y*yyy+sty;
return 0;
}