Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It is the last test of the basic ones.

    I change my code for it! True I was raising error only for negative value.
    But it is still failing.

  • Default User Avatar

    Is it the problem of case of donation = 0?
    Only positive donation should be return.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I am using c#. I have not idea how to return the error.

    Maybe you could google "C# throw error".

  • Default User Avatar

    May I ask about the error cases. I am using c#. I have not idea how to return the error.
    ErrorTests:
    Expected: <System.ArgumentException>
    But was: null

    I return -1 now but got this result. Can anyone help?

  • Default User Avatar

    If there is a little different of the numbers, you may check of your rounding method.

  • Default User Avatar

    I understand what do you mean. I am not presenting well. I agree that it is the best way for the computer to run.
    I just want to say that not all know this method. It also require your math skill.
    Not everyone has good math skill, but this method is the most fast way and clever.

  • Custom User Avatar

    I'm going to have to completely disagree with you banny127: this is the best answer because it was calculated before coding.

    Math first; code later. Your CPU will thank you.

    Programmers need to have a ton of tools in their toolbox, and your casual dismissal of "algebra" is, frankly, terrifying--given that all programming boils down to logical/mathematical computations.

  • Custom User Avatar

    That depends on the view of what is the best solution. However, in most computer algorithms the best solution (out of all that give correct results) the best is where is minimum used memory & CPU time. This is a solution in constant time because there was a previous analysis with pen & paper. That is what I call a real optimization - the author found a way of different solving of the same problem using less resources.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution