10137 the Trip has some new test case

The forum to report every bug you find or tell us what you'd like to find in UVa OJ's new system

Moderator: Board moderators

Post Reply
anthonyhl
New poster
Posts: 1
Joined: Sun Feb 09, 2014 5:58 pm

10137 the Trip has some new test case

Post by anthonyhl » Sun Feb 09, 2014 6:55 pm

Code: Select all

4
0.01
0.05
0.05
0.07
programme should return
$0.03
there are four students each spent 0.04(0.01+0.03), 0.04(0.05-0.01), 0.05 and 0.05(0.07-0.02) respectivily.

I found most of answers calculated the diff between average and each student' cost, like this

Code: Select all

if (average > students[i]) 
   debit += average - students[i];
else 
   refund += student[i] - average;

if (debit > refund) return refund;
else return debit.
if the average is round to cent, this code will miss the two student spent 0.05.

Post Reply

Return to “Bugs and suggestions”