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 |
真心测不出来,其实应该告诉我那组数据错了#include<stdio.h> #define N 30 char a[N][N],b[N];void z(int l,int t,char m1){if(a[l][t]==m1||a[l][t]=='.')a[l][t]=m1;else a[l][t]='X';} void juge(char w,char m){int i,j;for(i=0;i<30;i++)for(j=0;j<30;j++)switch(m){case 'U': if(a[29-i][j]==w){a[29-i][j]='.';if(29-i!=29) z(29-i+1,j,w);}break;case 'D': if(a[i][j]==w){a[i][j]='.';if(i!=0) z(i-1,j,w);}break;case 'R': if(a[i][29-j]==w){a[i][29-j]='.';if(29-j!=29) z(i,29-j+1,w);}break;case 'L':if(a[i][j]==w){a[i][j]='.';if(j!=0) z(i,j-1,w);}break;}} void main(){int c[N][3],i,j,n,m,x,y;for(i=0;i<N;i++)for(j=0;j<N;j++)a[i][j]='.';scanf("%d",&n);for(i=0;i<n;i++){b[i]=getchar();while(b[i]==' '||b[i]==10) b[i]=getchar();scanf("%d %d %d",&c[i][0],&c[i][1],&c[i][2]);}for(j=0;j<n;j++) for(m=c[j][0]-1;m>=0;m--){x=c[j][2];y=c[j][1];switch(b[j]){case 'U':a[x-m][y]=j+48;break;case 'D':a[x+m][y]=j+48;;break;case 'R':a[x][y-m]=j+48;break;case 'L':a[x][y+m]=j+48;break;}} for(j=0;j<30;j++)for(i=0;i<n;i++)juge(i+48,b[i]); for(i=0;i<6;i++){if(i%3==0) printf(" ");for(j=0;j<10;j++)i<3?printf("%2d",i):printf("%2d",j);if((i+1)%3==0) putchar(10);} for(i=N-1;i>=0;i--){printf("%.2d",i);for(j=0;j<N;j++)printf("%2c",a[i][j]);putchar(10);}putchar(10);} Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator