Page 1 of 2

11244 - Counting Stars

Posted: Fri Aug 17, 2007 6:06 am
by rongtuli
hi,
i can not find out the bug in my program.why the online judge treat my program as WA. can anyone give me some output for the problem.

Posted: Fri Aug 17, 2007 9:37 am
by Jan
Did you check the boundary cases carefully? However, you can post your code.

Posted: Fri Aug 17, 2007 3:40 pm
by rongtuli
thank u jan bhai i checked the boundary. but anyway i reprogrammed it in another way and already got AC. :D

11244 wa

Posted: Mon Sep 03, 2007 10:16 am
by rossi kamal
i am getting wrong answer...
i have removed each steps result with an array v[][].-that will not allow the future result changed

still cannot understand why i am getting wrong answer ..

Posted: Mon Sep 03, 2007 10:17 am
by rossi kamal
/*
Rossi Kamal
acm id 26373
prb id 11244
simple grid

*/


#include<stdio.h>
int check(int x,int y);
char a[205][205];
int v[205][205];
int helper[8][2]={-1,-1,-1,0,-1,+1,1,+1,+1,+1,+1,0,+1,-1,0,-1 };

int main()
{

//freopen("in11244.txt","r",stdin);
int res,i,j,row,column;


while(scanf("%d %d\n",&row,&column)==2 )
{
int c=0;
if(row==0 && column==0)
break;

for(i=0;i<row;i++)
gets(a);

for(i=0;i<row;i++)
for(j=0;j<column;j++)
v[j]=1;

for(i=0;i<row;i++)
for(j=0;j<column;j++)
if(a[j]=='*')
{
res=check(i,j);
if(res==1)
{

c++;

}
}


for(i=0;i<row;i++)
for(j=0;j<column;j++)
v[j]=0;


printf("%d\n",c);

}








return 0;
}


int check(int xx,int yy)
{
int ii;
for(ii=0;ii<8;ii++)
{
int aa,bb;
aa=xx+helper[ii][0];
bb=yy+helper[ii][1];

if(v[aa][bb]==1&&a[aa][bb]=='*')
return 0;


}

return 1;
}


here is my code

Posted: Mon Sep 03, 2007 12:16 pm
by mmonish
I think this portion of ur code is not correct.

Code: Select all

int helper[8][2]={-1,-1,-1,0,-1,+1,1,+1,+1,+1,+1,0,+1,-1,0,-1 };
Hope this helps.

Re: 11244 - Counting Stars

Posted: Mon May 26, 2008 7:13 am
by Obaida
I don't know why I am getting Wrong Answer.! I think I checked all the things.

Code: Select all

Removed

Re: 11244 - Counting Stars

Posted: Mon May 26, 2008 4:42 pm
by rio
Read the problem description more carefully.
You have misunderstood the definition of star.

-----
Rio

Re: 11244 - Counting Stars

Posted: Tue May 27, 2008 9:44 am
by Obaida
Can you explain it to me??? I again got WA...!!! :(

Re: 11244 - Counting Stars

Posted: Thu May 29, 2008 5:39 am
by rio
Well, there is nothing to explain.
The problem statement is written clearly enough. There is no word to add.

-----
Rio

Re: 11244 - Counting Stars

Posted: Thu May 29, 2008 10:43 am
by Obaida
I don't know why this time I got WA!!! :x

Code: Select all

Thanks rio Now Accepted.
:oops:

Re: 11244 - Counting Stars

Posted: Fri May 30, 2008 4:18 pm
by rio
Look over your code few more times.
Its an obvious mistake. Not hard to find.

-----
Rio

Re: 11244 - Counting Stars

Posted: Sat May 31, 2008 11:42 am
by Obaida
I am really sorry rio. :oops: :oops: :oops:
That was happening for my careless checking. I can't even think about it. :oops:
It was a foul mistake. Thank you.

Re: 11244 - Counting Stars

Posted: Sun Nov 16, 2008 6:05 am
by Obaida
what type of language it is???? :D

Re: 11244 - Counting Stars

Posted: Fri Jul 31, 2009 10:48 am
by calicratis19
deleted