| ||||||||||
| 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:请教高手:我运行程序结果是对的,为什么提交显示wrong answer!In Reply To:请教高手:我运行程序结果是对的,为什么提交显示wrong answer! Posted by:flyinthesky at 2005-03-20 00:12:54 > struct mm {
> char s[5];
> int x;
> int y;
> int l;
> };
>
> #include <stdio.h>
> #include <string.h>
>
> void main(){
>
> int grid[100][100];
>
> int n=1;
> mm p[101];
> scanf("%d",&n);
> if(n>=1&&n<=100){
> for(int t=1;t<=n;t++)
> {scanf("%s %d %d %d",p[t].s,&(p[t].x),&(p[t].y),&(p[t].l));}
>
>
> }
> for (int k=1;k<=n;k++){
> if(strcmp(p[k].s,"BLACK")==0){
> for(int i=p[k].x;i<=(p[k].x+p[k].l-1);i++)
> for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> grid[i][j]=1;
> }
> else
> {if(strcmp(p[k].s,"WHITE")==0){
> for(int i=p[k].x;i<=(p[k].x+p[k].l)-1;i++)
> for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> grid[i][j]=0;
> }
> else if(strcmp(p[k].s,"TEST")==0){
> int sum=0;
> for(int i=p[k].x;i<=(p[k].x+p[k].l-1);i++)
> for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> if (grid[i][j]==1)
> sum++;
> printf("%d\n",sum);
> }
> }
> }
> }
>
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator