ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1348. Goat in the Garden 2

Help!WA#18
Posted by Amandosov 6 Jan 2013 19:26
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
Posted by Rafiduzzaman Sonnet 2 Jun 2015 23:31
My program gives the correct output for the test you gave, but still getting wrong answer on test#18. Any suggestions?