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 |
111#include<cstdio> #include<cstring> using namespace std; int main() { int t,m,n,num; char a[11][11]; scanf("%d",&t); while(t--) { num=0; scanf("%d%d",&m,&n); for(int i=0;i<m;i++)scanf("%s",&a[i]); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { if(a[i][j]=='|') { if(i-1>=0&&a[i-1][j]=='|');else num++; } else if(a[i][j]=='\\') { if(i-1>=0&&j-1>=0&&a[i-1][j-1]=='\\');else num++; } else if(a[i][j]=='/') { if(i-1>=0&&j+1<n&&a[i-1][j+1]=='/');else num++; } else if(a[i][j]=='-') { if(j-1>=0&&a[i][j-1]=='-');else num++; } } } if(num==1)printf("CORRECT\n"); else printf("INCORRECT\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator