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 |
这是怎么了?#include <stdio.h> #include <string.h> #define N 100+10 int chess[N][N]; int main() { int n,x,y,l,i,j,count,k; char op[10]; scanf("%d",&n); memset(chess,0,sizeof(chess)); for(k=1;k<=n;k++) { scanf("%s %d %d %d\n",op,&x,&y,&l); switch(op[0]) { case'B': { for(i=x;i<=x+l-1;x++) for(j=y;j<=y+l-1;j++) chess[i][j]=1; break; } case 'W': { for(i=x;i<=x+l-1;x++) for(j=y;j<=y+l-1;j++) chess[i][j]=0; break; } case 'T': { count=0; for(i=x;i<=x+l-1;i++) for(j=y;j<=y+l-1;j++) if(chess[i][j]) count++; printf("%d\n",count); break; } } } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator