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> int main() { char s[100][100],ch; int t,a,b,i,j,k,x,y,vis; scanf("%d",&t); //t+=1; while(t--) { scanf("%d%d",&a,&b); vis=k=x=y=0; for(i=0;i<a;i++) scanf("%s",s[i]); for(i=0;i<a;i++) for(j=0;j<b;j++) if(s[i][j]!='.') { vis++; if(vis==1) { ch=s[i][j]; x=i;y=j; } } if(vis==0) printf("INCORRECT\n"); else { if(ch=='\\') { while((k+x)<b&&(k+y)<a) { k++; if(s[x][y]!=s[x+k][y+k]) break; } if(k!=vis) printf("INCORRECT\n"); else printf("CORRECT\n"); } if(ch=='/') { while((x-k)>=0&&(y-k)>=0) { k++; if(s[x][y]!=s[x-k][y-k]) break; } if(k==vis) printf("CORRECT\n"); else printf("INCORRECT\n"); } if(ch=='-') { while((x+k)<b) { k++; if(s[x][y]!=s[x+k][y]) break; } if(k==vis) printf("CORRECT\n"); else printf("INCORRECT\n"); } if(ch=='|') { while((y+k)<a) { k++; if(s[x][y]!=s[x][y+k]) break; } if(k==vis) printf("CORRECT\n"); else printf("INCORRECT\n"); } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator