11244 - Counting Stars
Moderator: Board moderators
11244 - Counting Stars
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.
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
Did you check the boundary cases carefully? However, you can post your code.
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- New poster
- Posts: 14
- Joined: Mon Sep 03, 2007 10:11 am
- Contact:
11244 wa
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 ..
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 ..
-
- New poster
- Posts: 14
- Joined: Mon Sep 03, 2007 10:11 am
- Contact:
/*
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
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
I think this portion of ur code is not correct.
Hope this helps.
Code: Select all
int helper[8][2]={-1,-1,-1,0,-1,+1,1,+1,+1,+1,+1,0,+1,-1,0,-1 };
Re: 11244 - Counting Stars
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.
This may be the address of success.
Re: 11244 - Counting Stars
Read the problem description more carefully.
You have misunderstood the definition of star.
-----
Rio
You have misunderstood the definition of star.
-----
Rio
Re: 11244 - Counting Stars
Can you explain it to me??? I again got WA...!!! 

try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 11244 - Counting Stars
Well, there is nothing to explain.
The problem statement is written clearly enough. There is no word to add.
-----
Rio
The problem statement is written clearly enough. There is no word to add.
-----
Rio
Re: 11244 - Counting Stars
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.
This may be the address of success.
Re: 11244 - Counting Stars
Look over your code few more times.
Its an obvious mistake. Not hard to find.
-----
Rio
Its an obvious mistake. Not hard to find.
-----
Rio
Re: 11244 - Counting Stars
I am really sorry rio.
That was happening for my careless checking. I can't even think about it.
It was a foul mistake. Thank you.



That was happening for my careless checking. I can't even think about it.

It was a foul mistake. Thank you.
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 11244 - Counting Stars
what type of language it is???? 

try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
-
- Learning poster
- Posts: 76
- Joined: Mon Jul 21, 2008 8:50 am
- Location: SUST,SYLHET,BANGLADESH.
- Contact:
Re: 11244 - Counting Stars
deleted
Last edited by calicratis19 on Fri Jul 31, 2009 6:20 pm, edited 1 time in total.
Heal The World