Page 2 of 2

Re: 11579 - Triangle Trouble

Posted: Mon Nov 21, 2011 7:43 am
by yatsen
I find what's wrong with my code in the above post.
In comp() for qsort(C language) I can not use

Code: Select all

int comp(double *p,double *q)
{ 
    return  *q-*p;
}
I should use

Code: Select all

int comp(double *p,double *q)
{ 
    if(*q-*p>0) return 1;   
    else if(*q-*p<0) return -1;   
    else return 0;
}
By the way, I have a wonder: Why can't we break the loop when I find a solution. Is it not the biggest area?

Re: 11579 - Triangle Trouble

Posted: Sun Aug 31, 2014 5:16 am
by battirunner
I tried out every possible input, still getting WA. need help for some critical input.. thanks in advance....

Re: 11579 - Triangle Trouble

Posted: Mon Dec 01, 2014 2:11 pm
by lighted
You can post your code

Re: 11579 - Triangle Trouble

Posted: Fri Jan 30, 2015 9:02 pm
by ehsanulbigboss
:D :D :D :D

Re: 11579 - Triangle Trouble

Posted: Fri Jan 30, 2015 11:54 pm
by brianfry713
Try running your code on the sample input.

Re: 11579 - Triangle Trouble

Posted: Tue Oct 20, 2015 2:48 pm
by dibery
One critical input, hope it helps someone.
Input:

Code: Select all

1
6 2.10 1.99 1.39 9.07 2.29 2.00
Output:

Code: Select all

1.95