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:LRJ还出这种水题???

Posted by yingxiang720 at 2010-11-29 20:34:04 on Problem 1656
In Reply To:LRJ还出这种水题??? Posted by:l3160732 at 2008-05-28 19:05:10
> 要是1000啥的还差不多。
#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