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:仅次于1000的第二简单题!!!!

Posted by wlfspmzc at 2009-01-01 17:11:49 on Problem 1656
In Reply To:仅次于1000的第二简单题!!!! Posted by:asdqwe at 2006-08-30 00:20:57
我这么写为什么不过呢?(1656)
#include<stdio.h>
#include<string.h>
int main()
{
    int n,sum=0;
    scanf("%d",&n);
    while(n--)
    {
        char str[10];
        int i,j,pla[101][101],x,y,l;
        memset(str,0,sizeof(str));
        scanf("%s %d %d %d",str,&x,&y,&l);
        if(strcmp(str,"WHITE")==0){
            for(i=x;(i<x+l)&&(i<101);i++)
                for(j=y;(j<y+l)&&(j<101);j++)
                    pla[i][j]=0;
        }
        else if(strcmp(str,"BLACK")==0){
            for(i=x;(i<x+l)&&(i<101);i++)
                for(j=y;(j<y+l)&&(j<101);j++){
                    pla[i][j]=1;
                }    
        }    
        else if(strcmp(str,"TEST")==0){
            for(i=x;i<x+l;i++)
                for(j=y;j<y+l;j++)
                    if(pla[i][j]==1)
                        sum++;
         printf("%d\n",sum);
         sum=0;
        }
    }
    getchar();
    getchar();
    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