11579 - Triangle Trouble

All about problems in Volume 115. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

yatsen
Learning poster
Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

Re: 11579 - Triangle Trouble

Post by yatsen » Mon Nov 21, 2011 7:43 am

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?

battirunner
New poster
Posts: 14
Joined: Fri Aug 15, 2014 3:48 pm

Re: 11579 - Triangle Trouble

Post by battirunner » Sun Aug 31, 2014 5:16 am

I tried out every possible input, still getting WA. need help for some critical input.. thanks in advance....

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11579 - Triangle Trouble

Post by lighted » Mon Dec 01, 2014 2:11 pm

You can post your code
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

ehsanulbigboss
New poster
Posts: 32
Joined: Tue Jul 22, 2014 1:17 am

Re: 11579 - Triangle Trouble

Post by ehsanulbigboss » Fri Jan 30, 2015 9:02 pm

:D :D :D :D
Last edited by ehsanulbigboss on Thu Feb 05, 2015 9:55 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11579 - Triangle Trouble

Post by brianfry713 » Fri Jan 30, 2015 11:54 pm

Try running your code on the sample input.
Check input and AC output for thousands of problems on uDebug!

dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

Re: 11579 - Triangle Trouble

Post by dibery » Tue Oct 20, 2015 2:48 pm

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
Life shouldn't be null.

Post Reply

Return to “Volume 115 (11500-11599)”