Ad
  • Custom User Avatar

    Oh, someone who gets it.

    Anyway, it seems you are wrong: the countless explanations from the author and from many other users explain that on an every New Years night, some festivities in the town are held which cause that every not fully developed citizen ceases to contribute to the next year's population. People gather around a big bonfire and perform some... customs, chanting: "there is no fractional people at the end of a year! there's no fractional people..." As a big fan of Silent Hill, Twin Peaks, and "The Village", I like this explanation a lot.

    Just think of it as a custom of the town's community, incorporate it into your solution, and you will pass no problem. As they say, "In Sile Rome do as Romans do" .

  • Custom User Avatar

    @Chrono79 the logic is wrong. If 0.4 represents a baby, then even if you don't count it NOW, you must count it once it reaches 1.0. By rounding down, you're literally eliminating real values—and that's incorrect.

    If you want to round down, I see two options:

    1. set the decimal value to the side, to be factored in when the algorithm raises it to a whole number, or
    2. round down or up to the nearest whole number once—at the very end—because the decimals don't ACTUALLY represent babies, but it does represent REAL growth
  • Custom User Avatar

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

  • Custom User Avatar

    And what if we count every month instead of year, more unborn babies being thrown out of the equation. Let's count every single second, your answer will always be 0. What kind of algorithm has a different outcome depending on the observation period being chosen? :/

  • Custom User Avatar

    No, you can think of fractional people as unborn babies, they're still not born so you should not count them. If you think how population grows, it makes much more sense, because people doesn't grow an extra pair of limbs, right? And even if that would happen, you'll still count that as a single person.

  • Default User Avatar

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

  • Custom User Avatar

    Show some demographic data where there are populations with not integer numbers if you want to prove your point.

  • Default User Avatar
  • Default User Avatar

    The answer is to divide by 2, if the remainder is 1, then it is odd, and if the remainder is 0, it is even

  • Default User Avatar
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar
  • Custom User Avatar

    Yes, 10 has two digits, so you need to continue until you arrive to a single-digit value.

  • Custom User Avatar

    Incorrect answer for n=10: expected 10 to equal 1 Completed in 2ms Should pass random tests Incorrect answer for n=563527: expected 10 to equal 1
    10 is not a single-digit number? Is it should next 10 --> 1 + 0 = 1 ? Is a test case error ??

  • Loading more items...