Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void DirectionalMove () {
- char a[] = {'W', 'S', 'W', 'N'};
- int t, n;
- int s;
- cin >> t;
- int pos=0;
- while(t--){
- cin >> n;
- for(int i = 0; i < n; i++){
- cin >> s;
- if(s == 0) {
- pos-=1;
- }
- else if(s == 1) {
- pos+=1;
- }
- }
- cout << a[pos];
- pos = 0;
- }
- }
- int main() {
- DirectionalMove();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement