Page 2 of 4
10823 WA
Posted: Sun Mar 13, 2005 4:37 pm
by A1
I am getting WA in this easy problem, please help
Code: Select all
#include <stdio.h>
Thanks to every one
I cut the code after AC
Posted: Sun Mar 13, 2005 7:46 pm
by Dreamer#1
Code: Select all
dr=((double)tr/(double)co)+0.5000001;
dg=((double)tg/(double)co)+0.5000001;
db=((double)tb/(double)co)+0.5000001;
r=dr;
g=dg;
b=db;
your rounding part seems incorrect to me. if u need help on rounding check out the other post on this problem.
Posted: Mon Mar 14, 2005 2:39 am
by Emilio
To sumankar:
Maybe you got AC. But if not is the case, you must read your onCircle function, the line
Code: Select all
long d = (p.x-c.x)*(p.x-c.x) + (p.y-c.y)*(p.x-c.y);
must be
Code: Select all
long d = (p.x-c.x)*(p.x-c.x) + (p.y-c.y)*(p.y-c.y);
Posted: Mon Mar 14, 2005 6:28 am
by sumankar
I am moved!So many responses

Thanks a lot guys!
Anyway special thanks to Emilio - I spotted that glaring mistake, however
the problem was with precision, once again. So....
Regards,
Suman.
Need I/O.
Posted: Mon Mar 14, 2005 6:46 am
by _.B._
Greetings!
Time to post some I/O

Can anyone please post some critical Input/Output for this problem?
Is this I/O good?:
Input:
Code: Select all
3
1 1
SQUARE 0 0 5 0 0 0
0 5
3 3
CIRCLE 0 0 5 10 10 10
SQUARE 1 1 5 255 10 10
CIRCLE 5 5 3 0 0 0
5 6
6 5
8 5
3 9
CIRCLE 0 0 7 255 0 0
SQUARE 2 -1 6 0 0 255
CIRCLE 4 7 4 0 255 0
2 8
1 5
6 4
3 4
4 0
7 2
0 0
3 -1
20 20
Output:
Code: Select all
Case 1:
(0, 0, 0)
Case 2:
(0, 0, 0)
(0, 0, 0)
(0, 0, 0)
Case 3:
(0, 255, 0)
(128, 128, 0)
(0, 128, 128)
(85, 85, 85)
(128, 0, 128)
(0, 0, 255)
(255, 0, 0)
(0, 0, 0)
(255, 255, 255)
Thanks in advance!
Posted: Mon Mar 14, 2005 7:16 am
by sumankar
Looks good to me.My code (AC/PE) gives the same answers.
Regards,
Suman.
Good.
Posted: Mon Mar 14, 2005 7:28 am
by _.B._
Thanks Suman!
Now I need some critical input to test the precission of my code
sumankar wrote:My code (AC/PE)
Remember blank lines are only between test cases, maybe you are printing one extra line at the end of the output.
Keep posting!
Posted: Mon Mar 14, 2005 7:47 am
by sumankar
Code: Select all
r = (int)(((double)r+0.5)/(double)k );
g = (int)(((double)g+0.5)/(double)k);
b = (int)(((double)b+0.5)/(double)k);
changed my code from WA to AC/PE.
Code: Select all
r = (int)(((double)r)/(double)k + 0.5);
g = (int)(((double)g)/(double)k + 0.5);
b = (int)(((double)b)/(double)k + 0.5);
I know about that PE thing, but I am tooo lazy to print newlines correctly
Regards,
Suman.
Nada.
Posted: Mon Mar 14, 2005 8:01 am
by _.B._
I'll have to post my code to see if anyone can help me, because I am using:
unsigned int r, g, b, divisor;
Code: Select all
r = (double(r) / divisor) + .5;
g = (double(g) / divisor) + .5;
b = (double(b) / divisor) + .5;
and got WA, after your example, changed it to:
Code: Select all
r = (double(r) / double(divisor)) + .5;
g = (double(g) / double(divisor)) + .5;
b = (double(b) / double(divisor)) + .5;
and still WA
Maybe the reading of the data?
Posted: Mon Mar 14, 2005 8:26 am
by sumankar
So, how do you check if your point lies on a circle, or not?And squares?
Also, how do you calculate r?what is the starting value for color of a particular point?
Suman.
Posted: Mon Mar 14, 2005 9:32 am
by A1
if u need help on rounding check out the other post on this problem
I think there is no other post on this porblem

. better you give me some hints.
Posted: Mon Mar 14, 2005 10:28 am
by sumankar
Posted: Mon Mar 14, 2005 11:57 am
by mf
I used this macro to round fractions p/q:
#define ROUND(p,q) ((int)((((double)(p)) / ((double)(q))) + 0.5 + 10e-9))
I got accepted without any problems.
Please, take a look.
Posted: Mon Mar 14, 2005 12:56 pm
by _.B._
NOTE: Thanks sumankar. Changed code: added borde = false, but still WA
Greetings!
Here's part of my code for this problem. Any ideas?
Posted: Mon Mar 14, 2005 1:07 pm
by sumankar
Where are you differentiating between the fact that an object lies on
or within a circle/square.Your in_square method returns true for both the cases.
Suman.