| ||||||||||
| 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 | |||||||||
老是Output Limit Exceeded。。。求助。。新手#include <stdio.h>
#include <string.h>
int main()
{
int x, y, l, i, j;
int n;
char a[10];
int b[101][101]={0};
while (scanf("%d", &n)!=EOF)
{
for (i=0; i<n; i++)
{
scanf("%s", &a);
if (strcmp(a, "WHITE")==0)
{
scanf("%d%d%d", &x, &y, &l);
for (i=x-1; i<x+l-1; i++)
for (j=y-1; j<y+l-1; j++)
b[i][j]=0;
}
if (strcmp(a, "BLACK")==0)
{
scanf("%d%d%d", &x, &y, &l);
for (i=x-1; i<x+l-1; i++)
for (j=y-1; j<y+l-1; j++)
b[i][j]=1;
}
if (strcmp(a, "TEST")==0)
{
int count=0;
scanf("%d%d%d", &x, &y, &l);
for (i=x-1; i<x+l-1; i++)
for (j=y-1; j<y+l-1; j++)
if (b[i][j]==1)
count++;
printf ("%d\n", count);
}
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator