Advertisement
Bassel_11

Untitled

Aug 29th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void DirectionalMove () {
  5.  
  6.     char a[] = {'W', 'S', 'W', 'N'};
  7.     int t, n;
  8.     int s;
  9.     cin >> t;
  10.     int pos=0;
  11.  
  12.     while(t--){
  13.         cin >> n;
  14.         for(int i = 0; i < n; i++){
  15.             cin >> s;
  16.             if(s == 0) {
  17.                 pos-=1;
  18.             }
  19.             else if(s == 1) {
  20.                 pos+=1;
  21.             }
  22.         }
  23.         cout << a[pos];
  24.         pos = 0;
  25.     }
  26. }
  27. int main() {
  28.     DirectionalMove();
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement