Skiena's Programming Challenge [UVa ID 10137]- Getting WA
I did not run it (and I do not like to read it, too much abbreviations, wrong variable names, too less formatting), but what about this case:


  3
  1.01
  0.99
  0.99  


sum will be 2.99 / 3 = 0.9966666... 
roundAmt will be 0.99
ans will be 0
Obviously, it should be 0.01 to fulfill the requirement "so that the net cost to each is the same, to within one cent"

Beside this, please consider the things I mentioned in the beginning. Some concrete examples:


  sum/=numStudents;


This is not a sum anymore, it is the average.


  loopVar1


Take i, this is expected for a loop variable


  numStudents


Could be: number_of_students or numberOfStudents

for(loopVar1=0;loopVar1&lt;numStudents;loopVar1++)


Could be: for (i = 0; i &lt; number_of_students; ++i)

for(loopVar1=0;loopVar1&lt;numStudents;loopVar1++)
            if(nums[loopVar1]&lt;roundAmt)
                ans+=(roundAmt-nums[loopVar1]);


One could discuss if using the short form without brackets is ok for one line statements, but if it spans over multiple lines, please use brackets, even if it is syntactically ok.

what does roundAmt mean?

and so forth.