Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Trello, Facil, Comando de robot
- #include <iostream> /// AlenAntonelli
- using namespace std;
- int main ()
- {
- int x, y, xm, ym;
- string ORD;
- cin>>x>>y>>xm>>ym>>ORD;
- for (int i=0; i<ORD.size(); i++)
- {
- switch (ORD[i])
- {
- case 'N':
- if (y!=ym) y++;
- break;
- case 'S':
- if (y!=1) y--;
- break;
- case 'E':
- if (x!=xm) x++;
- break;
- case 'O':
- if (x!=1) x--;
- break;
- }
- }
- cout<<x<<" "<<y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment