|
|
back to boardHelp!WA#18 This is my code #include <iostream> #include <stdio.h> #include <math.h> using namespace std; long n,x[201],y[201]; int main() {double xa,xb,xc,ya,yb,yc,l,a,b,c,x,h; cin>>xa>>ya>>xb>>yb>>xc>>yc>>l; b=sqrt((xc-xa)*(xc-xa)+(yc-ya)*(yc-ya)); a=sqrt((xc-xb)*(xc-xb)+(yc-yb)*(yc-yb)); c=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); if(c!=0){ x=(c*c+b*b-a*a)/(2.0*c); h=sqrt(b*b-x*x); if(b!=0&&a!=0){ if((b*b+c*c-a*a)/(2.0*b*c)<=0) h=b; if((a*a+c*c-b*b)/(2.0*a*c)<=0) h=a;}
if(h<=l) h=0; else h=h-l;} else h=a; printf("%0.2f\n",h);
if(a>=b) {if(a<=l) h=0; else h=a-l;} else {if(b<=l) h=0; else h=b-l;} printf("%0.2f\n",h);
return 0; }
Please give me some test Re: Help!WA#18 Posted by dimoxx 12 Apr 2015 18:39 Попробуйте 2 2 2 2 3 3 1 Ответ: 0.41 0.41 Re: Help!WA#18 My program gives the correct output for the test you gave, but still getting wrong answer on test#18. Any suggestions? |
|
|