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

111

Posted by 1004115224 at 2013-04-20 20:15:20 on Problem 3561
#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:
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