Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

挫代码也是可以贴出来的

Posted by TSERROF at 2012-10-08 20:43:30 on Problem 3561
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator