-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaoj1210.cpp
More file actions
62 lines (61 loc) · 1.16 KB
/
aoj1210.cpp
File metadata and controls
62 lines (61 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;
int dice[6] = {1,5,4,3,2,6};
void swap(int i, int j, int k, int l) {
int temp = dice[l];
dice[l] = dice[k];
dice[k] = dice[j];
dice[j] = dice[i];
dice[i] = temp;
}
int main() {
int n;
while(cin >> n, n) {
dice[0] = 1;
dice[1] = 5;
dice[2] = 4;
dice[3] = 3;
dice[4] = 2;
dice[5] = 6;
REP(i, n) {
string in; cin >> in;
if(in == "north")
swap(0,4,5,1);
else if(in == "south")
swap(0,1,5,4);
else if(in == "west")
swap(0,3,5,2);
else if(in == "east")
swap(0,2,5,3);
}
cout << dice[0] << endl;
}
return 0;
}