标签:style blog io color ar os sp 数据 div
East 1
0
North 1
1
North
East
1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 char s[10]; 6 int n; 7 int direction; 8 9 while(scanf("%s%d",&s,&n)!=EOF){ 10 while(n--){ 11 scanf("%d",&direction); 12 13 if(strcmp(s,"West")==0){ 14 if(direction==0){ 15 strcpy(s,"South"); 16 } 17 else 18 strcpy(s,"North"); 19 } 20 21 else if(strcmp(s,"East")==0){ 22 if(direction==0){ 23 strcpy(s,"North"); 24 } 25 else 26 strcpy(s,"South"); 27 } 28 29 else if(strcmp(s,"North")==0){ 30 if(direction==0){ 31 strcpy(s,"West"); 32 } 33 else 34 strcpy(s,"East"); 35 } 36 37 else if(strcmp(s,"South")==0){ 38 if(direction==0) 39 strcpy(s,"East"); 40 else 41 strcpy(s,"West"); 42 } 43 } 44 printf("%s\n",s); 45 } 46 return 0; 47 }
标签:style blog io color ar os sp 数据 div
原文地址:http://www.cnblogs.com/zqxLonely/p/4101333.html