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<iostream> #include <cstring> using namespace std; char map[105][105]; int row,col; int main() { int T; cin>>T; while(T--) { cin>>row>>col; memset(map,'.',sizeof(map)); int lines=0; for(int i=1;i<=row;++i) { for(int j=1;j<=col;++j) { cin>>map[i][j]; if(map[i][j]=='.')continue; if(map[i][j]=='\\') { if(map[i-1][j-1]=='\\' || map[i+1][j+1]=='\\')continue; else ++lines; } else if(map[i][j]=='/') { if(map[i+1][j-1]=='/' || map[i-1][j+1]=='/')continue; else ++lines; } else if(map[i][j]=='-') { if(map[i][j-1]=='-' || map[i][j+1]=='-')continue; else ++lines; } else if(map[i][j]=='|') { if(map[i+1][j]=='|' || map[i-1][j]=='|')continue; else ++lines; } } } if(lines==1)cout<<"CORRECT"<<endl; else cout<<"INCORRECT"<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator