11244 - Counting Stars

All about problems in Volume 112. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

rongtuli
New poster
Posts: 5
Joined: Fri Aug 17, 2007 4:38 am

11244 - Counting Stars

Post by rongtuli » Fri Aug 17, 2007 6:06 am

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.
by tulip

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Fri Aug 17, 2007 9:37 am

Did you check the boundary cases carefully? However, you can post your code.
Ami ekhono shopno dekhi...
HomePage

rongtuli
New poster
Posts: 5
Joined: Fri Aug 17, 2007 4:38 am

Post by rongtuli » Fri Aug 17, 2007 3:40 pm

thank u jan bhai i checked the boundary. but anyway i reprogrammed it in another way and already got AC. :D
by tulip

rossi kamal
New poster
Posts: 14
Joined: Mon Sep 03, 2007 10:11 am
Contact:

11244 wa

Post by rossi kamal » Mon Sep 03, 2007 10:16 am

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 ..

rossi kamal
New poster
Posts: 14
Joined: Mon Sep 03, 2007 10:11 am
Contact:

Post by rossi kamal » Mon Sep 03, 2007 10:17 am

/*
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

mmonish
Experienced poster
Posts: 109
Joined: Sun Mar 11, 2007 2:55 pm
Location: SUST

Post by mmonish » Mon Sep 03, 2007 12:16 pm

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.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11244 - Counting Stars

Post by Obaida » Mon May 26, 2008 7:13 am

I don't know why I am getting Wrong Answer.! I think I checked all the things.

Code: Select all

Removed
Last edited by Obaida on Thu May 29, 2008 10:53 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Re: 11244 - Counting Stars

Post by rio » Mon May 26, 2008 4:42 pm

Read the problem description more carefully.
You have misunderstood the definition of star.

-----
Rio

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11244 - Counting Stars

Post by Obaida » Tue May 27, 2008 9:44 am

Can you explain it to me??? I again got WA...!!! :(
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Re: 11244 - Counting Stars

Post by rio » Thu May 29, 2008 5:39 am

Well, there is nothing to explain.
The problem statement is written clearly enough. There is no word to add.

-----
Rio

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11244 - Counting Stars

Post by Obaida » Thu May 29, 2008 10:43 am

I don't know why this time I got WA!!! :x

Code: Select all

Thanks rio Now Accepted.
:oops:
Last edited by Obaida on Sat May 31, 2008 11:43 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Re: 11244 - Counting Stars

Post by rio » Fri May 30, 2008 4:18 pm

Look over your code few more times.
Its an obvious mistake. Not hard to find.

-----
Rio

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11244 - Counting Stars

Post by Obaida » Sat May 31, 2008 11:42 am

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.
try_try_try_try_&&&_try@try.com
This may be the address of success.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11244 - Counting Stars

Post by Obaida » Sun Nov 16, 2008 6:05 am

what type of language it is???? :D
try_try_try_try_&&&_try@try.com
This may be the address of success.

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.
Contact:

Re: 11244 - Counting Stars

Post by calicratis19 » Fri Jul 31, 2009 10:48 am

deleted
Last edited by calicratis19 on Fri Jul 31, 2009 6:20 pm, edited 1 time in total.
Heal The World

Post Reply

Return to “Volume 112 (11200-11299)”