Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define LL unsigned long long
- using namespace std;
- int main() {
- int c,t,n,w,s,e,b,tmp1,tmp;
- while (scanf("%d",&c)){
- if(c==0) break;
- t=1; n=2; w=3; s=5; e=4; b=6;
- while(c--){
- char buffer[1024];
- cin>>buffer;
- if(buffer[0]=='n'){
- tmp=s;tmp1=n;n=t;s=b;t=tmp;b=tmp1;
- }else if(buffer[0]=='s'){
- tmp=t;tmp1=s;t=n;s=tmp;n=b;b=tmp1;
- }else if(buffer[0]=='e'){
- tmp=t;tmp1=e;t=w;e=tmp;w=b;b=tmp1;
- }else if (buffer[0]=='w'){
- tmp=t;tmp1=w;t=e;w=tmp;e=b;b=tmp1;
- }
- }
- printf("%d\n",t);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement