Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
郁闷了,不知道为什么用C提交是WA,其余的都是RE ,查了半天也不知道哪错了,管理员给点测试数据嘛~In Reply To:谁能提供点数据,测试一晚上了找不出毛病 Posted by:19851105 at 2005-04-25 03:27:27 #include<stdio.h> #include<string.h> struct node { char d; int x; int y; int lenth; }s[120]; char e[350][350]; void pri() { int i,j; printf(" 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n"); printf(" 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9\n"); for(i=29;i>=0;i--) { printf("%.2d",i); for(j=0;j<30;j++) printf(" %c",e[i][j]); printf("\n"); } printf("\n"); } int main() { int n; int i,j,k,l; char c; int p,q,r; int t; int over; int temp; while(scanf("%d",&n)==1) { for(i=0;i<n;i++) { scanf("%c%c %d%d%d",&c,&s[i].d,&s[i].lenth,&s[i].x,&s[i].y); temp=s[i].x; s[i].x=s[i].y; s[i].y=temp; } for(i=0;i<31;i++) memset(e[i],'.',31); for(i=0;i<n;i++) { switch(s[i].d) { case 'U': p=-1;q=0;break; case 'D': p=1; q=0;break; case 'R': p=0; q=-1;break; case 'L': p=q; q=1;break; } for(j=s[i].x,k=s[i].y,r=0;r<s[i].lenth;j+=p,k+=q,r++) e[j][k]=i+48; } /* pri(); */ while(1) { over=0; for(i=0;i<n;i++) { switch(s[i].d) { case 'U': j=29; k=s[i].y; p=-1;q=0;break; case 'D': j=0; k=s[i].y; p=1;q=0;break; case 'R': j=s[i].x; k=29; p=0;q=-1;break; case 'L': j=s[i].x; k=0; p=0; q=1;break; default: break; } for(;j>=0&&j<30&&k>=0&&k<30;j+=p,k+=q) { if(e[j][k]==i+48) { over=1; if(j-p<0 || k-q< 0 || j-p>=30 || k-q>=30) { e[j][k]='.'; continue; } if(e[j-p][k-q]=='X') e[j][k]='.'; else { if(e[j-p][k-q]!='.') { e[j-p][k-q]='X'; e[j][k]='.'; } else { if(e[j-p][k-q]=='.') { e[j-p][k-q]=i+48; e[j][k]='.'; } } } } } /* pri();*/ } if(over==0) break; } pri(); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator