Page 8 of 9

please help me .....Why i got WA to 190?

Posted: Sat Dec 03, 2011 7:20 pm
by artless
:roll:
#include<stdio.h>
#include<math.h>
int main()
{
double x1,x2,x3,y1,y2,y3,a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3,D,g,f,c,G,F,r;
while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)==6)
{a1=2*x1;
a2=2*x2;
a3=2*x3;
b1=2*y1;
b2=2*y2;
b3=2*y3;
c1=c2=c3=1.0;
d1=(x1*x1)+(y1*y1);
d2=(x2*x2)+(y2*y2);
d3=(x3*x3)+(y3*y3);
// slove of 3 equations having 3 variable a*g+b*f+c=0
D=(a1*b2*c3+b1*a3*c2+c1*a2*b3)-(a1*c2*b3+b1*a2*c3+c1*b2*a3);
g=((b1*c3*d2+c1*b2*d3+d1*c2*b3)-(b1*c2*d3+c1*b3*d2+d1*b2*c3))/D;
f=((a1*c2*d3+c1*a3*d2+d1*a2*c3)-(a1*c3*d2+c1*a2*d3+d1*c2*a3))/D;
c=((a1*b3*d2+b1*a2*d3+d1*b2*a3)-(a1*b2*d3+b1*a3*d2+d1*a2*b3))/D;
G=2.0*g;
F=2.0*f;
r=sqrt(g*g+f*f-c);

printf("(x ");if(g<0) printf("- %.3lf)^2 + (y ",-g);
else if(g>=0)printf("+ %.3lf)^2 + (y ",g);
if(f<0) printf("- %.3lf)^2 = %.3lf^2\n",-f,r);
else if(f>=0) printf("+ %.3lf)^2 = %.3lf^2\n",f,r);
printf("x^2 + y^2 ");
if(G<0)printf("- %.3lfx ",-G);
else if(G>=0)printf("+ %.3lfx ",G);
if(F<0)printf("- %.3lfy ",-F);
else if(F>=0)printf("+ %.3lfy ",F);
if(c<0)printf("- %.3lf = 0\n",-c);
else if(c>=0)printf("+ %.3lf =0\n",c);
}
return 0;
}

why wa ........190...........????????????

Posted: Thu Dec 08, 2011 12:18 pm
by artless
#include<stdio.h>
#include<math.h>
int main()
{
double x1,x2,x3,y1,y2,y3,a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3,D,g,f,c,G,F,r;
while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)==6)
{a1=2.0*x1; a2=2.0*x2; a3=2.0*x3;
b1=2.0*y1; b2=2.0*y2; b3=2.0*y3;
c1=c2=c3=1.0;
d1=(x1*x1)+(y1*y1); d2=(x2*x2)+(y2*y2); d3=(x3*x3)+(y3*y3);

D=(a1*b2*c3+b1*a3*c2+c1*a2*b3)-(a1*c2*b3+b1*a2*c3+c1*b2*a3);
g=((b1*c3*d2+c1*b2*d3+d1*c2*b3)-(b1*c2*d3+c1*b3*d2+d1*b2*c3))/D;
f=((a1*c2*d3+c1*a3*d2+d1*a2*c3)-(a1*c3*d2+c1*a2*d3+d1*c2*a3))/D;
c=((a1*b3*d2+b1*a2*d3+d1*b2*a3)-(a1*b2*d3+b1*a3*d2+d1*a2*b3))/D;
G=2.0*g;
F=2.0*f;
r=sqrt(g*g+f*f-c);

printf("(x ");if(g<0) printf("- %.3lf)^2 + (y ",-g);
else if(g>=0)printf("+ %.3lf)^2 + (y ",g);
if(f<0) printf("- %.3lf)^2 = %.3lf^2\n",-f,r);
else if(f>=0) printf("+ %.3lf)^2 = %.3lf^2\n",f,r);
printf("x^2 + y^2 ");
if(G<0)printf("- %.3lfx ",-G);
else if(G>=0)printf("+ %.3lfx ",G);
if(F<0)printf("- %.3lfy ",-F);
else if(F>=0)printf("+ %.3lfy ",F);
if(c<0)printf("- %.3lf = 0\n",-c);
else if(c>=0)printf("+ %.3lf = 0\n",c);
}
return 0;
}

Re: please help me .....Why i got WA to 190?

Posted: Wed Dec 28, 2011 9:56 pm
by Neto_o
I'm not reading your code since it's not written with the needed spaces and indentation, I can give you some inputs/outputs from my Accepted code, so you can test:

Input:

Code: Select all

-34 23 -18 16 20 15
0 0 0 12 12 0
0 12 0 0 12 0
-143 200 -143 -100 200 200
0 0 0.0134 0.0325 0.0888 0.087787
0 0 0.00134 0.00325 0.0888 0.0087787
-42350 -800 0 0 4235 -800

Output:

Code: Select all

(x - 2.840)^2 + (y - 85.420)^2 = 72.481^2
x^2 + y^2 - 5.680x - 170.840y + 2051.200 = 0

(x - 6.000)^2 + (y - 6.000)^2 = 8.485^2
x^2 + y^2 - 12.000x - 12.000y + 0.000 = 0

(x - 6.000)^2 + (y - 6.000)^2 = 8.485^2
x^2 + y^2 - 12.000x - 12.000y + 0.000 = 0

(x - 28.500)^2 + (y - 50.000)^2 = 227.843^2
x^2 + y^2 - 57.000x - 100.000y - 48600.000 = 0

(x - 0.116)^2 + (y + 0.029)^2 = 0.120^2
x^2 + y^2 - 0.233x + 0.058y + 0.000 = 0

(x - 0.047)^2 + (y + 0.017)^2 = 0.050^2
x^2 + y^2 - 0.093x + 0.035y + 0.000 = 0

(x + 19057.500)^2 + (y + 112495.156)^2 = 114097.978^2
x^2 + y^2 + 38115.000x + 224990.312y + 0.000 = 0


Re: please help me .....Why i got WA to 190?

Posted: Wed Jan 04, 2012 2:08 pm
by artless
thank you... i got AC

Re: 190 WA

Posted: Tue Jan 31, 2012 7:09 am
by pecijackson
i did't see anything wrong bout your codes sir.try to rewrite the codes. if it's doesn't work. i'll re-write the codes for you

Re: 190 WA

Posted: Sat Mar 31, 2012 12:53 pm
by S.H.Bouwhuis
Here are some sample inputs and outputs for my accepted submission:

Input

Code: Select all

7.0 -5.0 -1.0 1.0 0.0 -6.0
1.0 7.0 8.0 6.0 7.0 -2.0
5 5 4 7 16 5
56 40 66 76 31 8
44 39 26 23 37 38
18 82 29 41 33 15
0 49 19 56 98 3
7 0 11 0 9 2
0 9 0 15 3 12
0.0 0.0 1.0 0.0 0.0 2.0
6.6  2.5 -4.0 -4.0  6.6 -8.0
3.7 -4.1  3.7 -1.5  1.0  1.0
9.0 -2.0  1.0  1.0 -5.0 -2.0
5.4  6.3  0.0  6.3 -7.8 -0.8
3.1  4.1  5.9  2.6  5.3  5.8
10.0 11.0 12.0 13.0  0.0  0.0
0.0 0.0 1.1 0.0 0.0 1.1
Output

Code: Select all

(x - 3.000)^2 + (y + 2.000)^2 = 5.000^2
x^2 + y^2 - 6.000x + 4.000y - 12.000 = 0

(x - 3.921)^2 + (y - 2.447)^2 = 5.409^2
x^2 + y^2 - 7.842x - 4.895y - 7.895 = 0

(x - 10.500)^2 + (y - 9.000)^2 = 6.801^2
x^2 + y^2 - 21.000x - 18.000y + 145.000 = 0

(x + 33.686)^2 + (y - 84.302)^2 = 100.031^2
x^2 + y^2 + 67.372x - 168.603y - 1764.717 = 0

(x - 42.830)^2 + (y - 22.191)^2 = 16.849^2
x^2 + y^2 - 85.660x - 44.383y + 2042.957 = 0

(x + 279.295)^2 + (y + 19.738)^2 = 314.221^2
x^2 + y^2 + 558.590x + 39.475y - 20339.607 = 0

(x - 32.340)^2 + (y + 9.494)^2 = 66.838^2
x^2 + y^2 - 64.679x + 18.987y - 3331.372 = 0

(x - 9.000)^2 + y^2 = 2.000^2
x^2 + y^2 - 18.000x + 77.000 = 0

x^2 + (y - 12.000)^2 = 3.000^2
x^2 + y^2 - 24.000y + 135.000 = 0

(x - 0.500)^2 + (y - 1.000)^2 = 1.118^2
x^2 + y^2 - 1.000x - 2.000y = 0

(x - 2.526)^2 + (y + 2.750)^2 = 6.645^2
x^2 + y^2 - 5.053x + 5.500y - 30.211 = 0

(x + 0.011)^2 + (y + 2.800)^2 = 3.932^2
x^2 + y^2 + 0.022x + 5.600y - 7.622 = 0

(x - 2.000)^2 + (y + 8.500)^2 = 9.552^2
x^2 + y^2 - 4.000x + 17.000y - 15.000 = 0

(x - 2.700)^2 + (y + 4.501)^2 = 11.133^2
x^2 + y^2 - 5.400x + 9.001y - 96.399 = 0

(x - 4.883)^2 + (y - 4.066)^2 = 1.784^2
x^2 + y^2 - 9.767x - 8.131y + 37.195 = 0

(x - 142.500)^2 + (y + 119.500)^2 = 185.974^2
x^2 + y^2 - 285.000x + 239.000y = 0

(x - 0.550)^2 + (y - 0.550)^2 = 0.778^2
x^2 + y^2 - 1.100x - 1.100y = 0

Re: 190 WA

Posted: Sun Nov 18, 2012 11:14 pm
by emranbuet2002

Code: Select all

Removed after accepted!

Re: 190 WA

Posted: Tue Nov 20, 2012 3:00 am
by brianfry713
Print a single blank line after each equation pair including the last one.

Re: 190 WA

Posted: Tue Nov 20, 2012 3:44 pm
by emranbuet2002
Thanks!

190 WA Help plz

Posted: Mon Nov 26, 2012 6:39 am
by laituanksa245
I have tried all the test cases posted in this forum, but i still got WA.
Help me please. I feel so frustrated

Code: Select all

Code Removed
AC :P

Re: 190 WA Help plz

Posted: Fri Nov 30, 2012 9:09 pm
by brianfry713
Check the sample I/O, you're printing extra spaces.

Re: 190 WA Help plz

Posted: Mon Dec 03, 2012 4:30 am
by laituanksa245
Thank you so much.
You have helped me AC so many problems

Re: 190 WA Help plz

Posted: Tue Jan 01, 2013 10:27 pm
by alimbubt

Code: Select all

This is very easy problem...Just follow the process...

(1)try to make three equation with three coordinates.
(2)then try to find the value of unknown three variables with the process of determinant.
(3)be careful what the statement says "Plus, minus, and equal signs must be separated from the adjacent characters by a single space on each side."


Re: 190 WA Help plz

Posted: Wed Oct 09, 2013 8:48 pm
by mahade hasan
ACCCC

help please

Posted: Sat Apr 12, 2014 8:13 am
by ?????
what is my problem in this prob i cant find help please

#include<stdio.h>
#include<math.h>
#include<string.h>
void p(double x,double y,double temp,double ax,double ay)
{ :evil: :evil: :evil:
if(x==0)
{
printf("x^2 + ");
}
else if(x<0)
{
printf("(x + %0.3lf)^2 + ",(x*(-1)));
}
else if(x>0)
{
printf("(x - %0.3lf)^2 + ",x);
}
if(y==0)
{
printf("y^2 = %0.3lf^2\n",temp);
}
else if(y<0)
{
printf("(y + %0.3lf)^2 = %0.3lf^2\n",(y*(-1)),temp);
}
else if(y>0)
{
printf("(y - %0.3lf)^2 = %0.3lf^2\n",y,temp);
}
temp=pow(x,2)+pow(y,2)-pow(temp,2);
printf("x^2 + y^2 ");
if(x<0)
{
printf("+ %0.3lfx ",(x*(-2)));
}
else if(x>0)
{
printf("- %0.3lfx ",(x*2));
}
if(y<0)
{
printf("+ %0.3lfy ",(y*(-2)));
}
else if(y>0)
{
printf("- %0.3lfy ",(y*2));
}

if(temp<=0)
{
printf("- %0.3lf ",(temp*(-1)));
}
else if(temp>0)
{
printf("+ %0.3lf ",temp);
}
printf("= 0\n");
return ;
}
void britto(double ax,double ay,double bx,double by,double cx,double cy)
{
double temp1,temp2,temp3,temp4,temp,x,y,ax1,ay1,bx1,by1,cx1,cy1;
ax1=pow(ax,2);
ay1=pow(ay,2);
bx1=pow(bx,2);
by1=pow(by,2);
cx1=pow(cx,2);
cy1=pow(cy,2);
temp1=(((bx1+by1-cx1-cy1)*(ay-by)*(-1))/2);
temp2=((ax1+ay1-bx1-by1)*(by-cy))/2;
temp3=((ax1+ay1-bx1-by1)*(bx-cx)*(-1))/2;
temp4=((bx1+by1-cx1-cy1)*(ax-bx))/2;
temp=((ax-bx)*(by-cy)) -((ay-by)*(bx-cx));
x=(temp1+temp2)/(temp);
y=(temp3+temp4)/(temp);
temp1=pow((x-ax),2);
temp2=pow((y-ay),2);
temp=sqrt((temp1+temp2));
p(x,y,temp,ax,ay);
return ;
}
int main()
{
double ax,ay,bx,by,cx,cy;
for( ;(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy))==6;)
{
britto(ax,ay,bx,by,cx,cy);
}

return 0;
}