| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:仅次于1000的第二简单题!!!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator