题解 | #迷路的牛牛#
迷路的牛牛
http://www.nowcoder.com/practice/fc72d3493d7e4be883e931d507352a4a
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string str; cin>>str; int lcont=0,rcont=0; for(auto c:str){ if(c=='L') lcont++; if(c=='R') rcont++; } int tmp = rcont-lcont; while(tmp<0) tmp+=4; while(tmp>=4) tmp%=4; string move = "NESW"; cout<<move[tmp]<<endl; }