题目:
代码:
int main(){int rownum=3,colnum=4,stepsnum=4,starth=0,startw=0;cin>>rownum>>colnum>>stepsnum;vector<string> s(rownum,"");for(int i=0;i<rownum;i++){cin>>s[i];for(int j=0;j<colnum;j++){if(s[i][j]=='@'){starth=i;startw=j;}}}for(int i=0;i<stepsnum;i++){string d="";cin>>d;if(d=="EAST"){while(startw<colnum-1){if(s[starth][startw+1]=='#'){break;}startw++;}}else if(d=="SOUTH"){while(starth<rownum-1){if(s[starth+1][startw]=='#'){break;}starth++;}}else if(d=="WEST"){while(startw>0){if(s[starth][startw-1]=='#'){break;}startw--;}}else{while(starth>0){if(s[starth-1][startw]=='#'){break;}starth--;}}}cout<<starth+1<<" "<<startw+1;return 0;
}