2012 金华现场赛K题
2012-10-30 14:52
302 查看
http://acm.hdu.edu.cn/showproblem.php?pid=4452
英语弱成渣,没看懂题目之前,样例没看明白。。trun around没注意。还有交换方向的时候理解错一句话,应该是题目写错了。
模拟就是
View Code
英语弱成渣,没看懂题目之前,样例没看明白。。trun around没注意。还有交换方向的时候理解错一句话,应该是题目写错了。
模拟就是
View Code
#include <stdio.h> #include <stdlib.h> int main() { int n,t1,s1,t2,s2,k; char ch1,ch2; char temp1,temp2; int x1,y1,x2,y2; int i; int count1,count2; while(~scanf("%d",&n),n) { x1=y1=1; x2=y2=n; count1=0; count2=0; getchar(); scanf("%c%d%d",&ch1,&s1,&t1); getchar(); scanf("%c%d%d",&ch2,&s2,&t2); scanf("%d",&k); temp1=ch1; temp2=ch2; for(i=1;i<=k;i++) { count1++; count2++; if(ch1=='E') { x1+=s1; if(x1>n) { ch1='W'; x1=2*n-x1; } } else if(ch1=='W') { x1-=s1; if(x1<1) { ch1='E'; x1=2*1-x1; } } else if(ch1=='N') { y1-=s1; if(y1<1) { ch1='S'; y1=2*1-y1; } } else if(ch1=='S') { y1+=s1; if(y1>n) { ch1='N'; y1=2*n-y1; } } if(ch2=='E') { x2+=s2; if(x2>n) { ch2='W'; x2=2*n-x2; } } else if(ch2=='W') { x2-=s2; if(x2<1) { ch2='E'; x2=2*1-x2; } } else if(ch2=='N') { y2-=s2; if(y2<1) { ch2='S'; y2=2*1-y2; } } else if(ch2=='S') { y2+=s2; if(y2>n) { ch2='N'; y2=2*n-y2; } } //printf("%c %c\n%d %d\n\n\n",ch2,ch1,y2,x2); if(x1==x2&&y1==y2) { char tp; tp=ch1; ch1=ch2; ch2=tp; } else { if(count1>=t1) { if(ch1=='E') ch1='N'; else if(ch1=='N') ch1='W'; else if(ch1=='S') ch1='E'; else if(ch1=='W') ch1='S'; count1=0; } if(count2>=t2) { if(ch2=='E') ch2='N'; else if(ch2=='N') ch2='W'; else if(ch2=='S') ch2='E'; else if(ch2=='W') ch2='S'; count2=0; } } //printf("[[%d %d]],[[%d %d]][[%c]]\n",y1,x1,y2,x2,ch2); } printf("%d %d\n%d %d\n",y1,x1,y2,x2); } return 0; }
相关文章推荐
- HDU 4451 Dressing 2012亚洲区域赛金华现场赛
- 2012 金华 现场赛
- HDU 4445Crazy Tank 2012金华现场赛D题(暴力枚举)
- 2012 金华现场赛 A题
- hdu4445 CRAZY TANK 2012金华赛区现场赛D题
- 2012 金华现场赛 I题
- 2012 金华现场赛 J题
- 2012 金华 现场赛
- 2012金华现场赛
- 2012 金华赛区现场赛
- hdu4445 CRAZY TANK 2012金华赛区现场赛D题
- ACM/ICPC 2012金华regional现场赛C题 hdu4444 离散化、最短路
- HDU 4450 Draw Something 2012亚洲区域赛金华现场赛I题
- HDU 4442 Physical Examination 2012亚洲区域赛金华现场赛A题
- 2012金华现场赛四个水题题解(积分赛第四场)
- poj 4052 Hrinity 2012 金华邀请赛 AC自动机 DFA
- 2012长春现场赛b Bit Magic
- 2012 chengdu现场赛 Browsing History HDU4464(简单字符串)
- 第37届ACM/ICPC 金华赛区现场赛最水四道题 HDU 4442 Physical Examination HDU 4450 Draw Something HDU 4451 Dressing HDU 4452 Running Rabbits
- 2012成都现场赛