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

Re:暑期 AC 第 五十道 水题 留念!

Posted by yingxiang720 at 2010-11-29 20:34:11 on Problem 1656
In Reply To:暑期 AC 第 五十道 水题 留念! Posted by:jinlisu at 2010-07-18 17:38:40
> 加油!!!
#include <stdio.h>

int des[100][100],i,j,n,x,y,L;
char s[10];

int main()
{
    for(i = 0;i < 100;i++)
        for (j = 0;j < 100;j++)
            des[i][j] == 0;
    scanf("%d",&n);
    while (n-- >0)
    {
        scanf("%s %d %d %d",s,&x,&y,&L);
        if (s[0] == 'B')
            for (i = x;i<x+L;i++)
                for (j = y;j <y+L;j++)
                    des[i][j] = 1;
        if (s[0] == 'W')
            for (i = x;i<x+L;i++)
                for (j = y;j <y+L;j++)
                    des[i][j] = 0;
        if (s[0] == 'T')
        {   
            int count = 0;
            for (i = x;i<x+L;i++) 
                for (j = y;j <y+L;j++)
                    if (des[i][j] == 1) 
                        count++;
             printf("%d\n",count);
        }
    }
}

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