6 kyu

Bonuses

662 of 1,432g964
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar
  • syeo66 Avatar

    I don't know about the other languages, but the rounding part of the kata in Lua feels somewhat 'random', the expectation should be mentioned in the Kata.

  • alexc19 Avatar

    Nice kata, thank you. I don't think John is acting as fairly as possible though :) In real life the duration of the period, i.e. how many worked days, should also be considered. For instance if C was absent 12 days over a year they should still get a similar amount as A, not 1.5x.

  • Azinho Avatar

    This comment has been hidden.

  • drukkhua Avatar

    This comment has been hidden.

  • ddshcharbunou Avatar

    No problems with coding, it's just math)

  • Abysswalker1994 Avatar

    This comment has been hidden.

  • user1430804 Avatar

    This comment has been hidden.

  • laurelis24 Avatar

    You can sit here all day. And still dont know the answer... This is a guessing for me. Trying possible ways with calc, i think i give up. xD I know it's very simple math probably, but still without formula, almost impossible. Mby im just stupid.

  • A_Vaclav Avatar

    Attention, in the comments of the code, solutions from @ kiri11-mi1 contain obscene expressions in Russian.

  • garrypas Avatar

    This is a maths puzzle and should be marked as such, or the appropriate calculus provided

  • romaxa11 Avatar

    My first 6kyu kata. Thank you!

  • RevRift Avatar

    Nice kata! My first solution was too slow and I had to optimise it.

  • monadius Avatar

    Updated Dart translation (Dart 2.14).

  • seminyoon1 Avatar

    Super fun to solve! I struggled a lot on finding the method to get to the numbers, maybe you should make it to 2 decimal points because we are dealing with money after all?

  • velvetx Avatar

    hard to solve this random test case

  • Lavrivskyi Avatar

    This kata is not about the "fair" distribution of the bonus among employees. What about employees without absences? This kata must have tag "Mathematics".

  • prayaamadiga Avatar

    The logic seems doesn't make sense since it cannot support when employee have 0 days of absence. and because it use Math.round there will be possibility 2 or more employee will have ratio with x.5 that cause the sum result is higher than the input

  • dfhwze Avatar

    "There are only integers, no floats". For Perl you give us a hint on using "BigInt". Is there a similar data type for Raku, or should "Int" suffice?

  • SibelTheCat Avatar

    Hey I am a little stuck here and was wondering if someone could give me a hint. I have a solution that works for the first test but not the big ones. But I am also using float in my code.I guess thats the problem. Am I right that the solution does not need float variables in the code? So I need to find an algorithm that does not neet that?

  • dstavis Avatar

    This is more of a math problem than a coding problem. Turns out I didn't know the math. I guessed and looked up systems of equations, which isn't it. Finally by typing in this particular problem I found a question on the mathematics stackOverflow for this specific kata, and found a formula that worked. This is a programming site, not a math site. IMO the directions should include exactly what mathematics principles to use. I didn't know enough math to know that I didn't know enough math to solve this when I read the directions, which is kind of a self-defeating problem. I couldn't have known to avoid this problem, because I don't know enough to solve the problem. Anyway, I'll write the name of the mathematics principle in a reply to this comment, as well as a link to the stackoverflow question where I found it, for anyone who was in a similar situation to me.

  • akar-0 Avatar

    Is it possible an employee to have 0 days of absence?

  • razvanboboc Avatar

    This comment has been hidden.

  • HusseinR Avatar

    needs some good math skills😅

  • lmcknight16 Avatar

    Can someone tell me why I would be pass close to 99% of the final attempts. Fails are always large numbers and a couple thousand dollars off certain values. Sounds like a rounding issue, but I am not rounding prematurely.

  • lechevalier Avatar

    Can you tag this kata as Puzzle to prevent players to begin another guess the formula kata?

  • Oleg-cmd Avatar

    Any solution of mine that includes // (python integer division) simply doesn't work on codewars throws out timeout. Using other solutions throws int overflows. Everything works fine on the locale.

  • Belator Avatar

    The most difficult thing is to understand the counting algorithm, but the randomo check does not work correctly. there are numbers for which an integer answer will not work, and if you get a more accurate result, then the built-in еуые will uncorrect

  • soggybiscuit Avatar

    Still working trying to figure out the algorithm! LOL I know its something simple that I'm missing. Someone point me in the correct direction, No answer's just a hint.

  • Luke_W_M Avatar

    I think the wording could be improved. The instuctions mention that absense is for the last year, and that the solution should be "fair". If a colleague had taken one day off in a year, and you had taken two days off... meaning you had worked (depending on how many days per year you score it, but doesn't really matter) about 99% of the time they worked... but your bonus share according to the algoritm you have used would be way way less. (Shan't give the exact number... as it's kind of a spoiler to this "guess the math from the tests" kata)... but it's definitely not "fair". I think at minimum the mention of a year should be removed...

  • JuniorSM Avatar

    I am continuously failing random test cases Please help.

  • JiPiBi Avatar

    The only difficulty of this kata was for me to find the mathematical function you use to share the pie. But why using that function and not another : for example if I take the square or the log of your function , it seems to work too, indeed with another repartition of bonuses. So my code was linked to the test cases you gave , and I found that a bit strange Did I miss sthg ?

  • lonkaan Avatar

    I would tag this puzzle instead of fundamentals tho.

  • JohanWiltink Avatar
  • Ciprian Amza Avatar

    This comment has been hidden.

  • rowcased Avatar

    C Translation kumited!

  • user8436785 Avatar

    lol, the python solution in crystal absolutely does not work

  • rowcased Avatar

    @g964

    (my apologies for the absurdly gargantuan previous post)

    if you may recall, my python solution failed only on the first attempt... while working on the C translation I thought I would re-try finding a random case that would fail my solution, and I did. :(

    input a is labled as daysoff input b is labled as surplus

    wrong answer my solution gave is labled my_fail correct answer is labled as bonuses (yeah, I shouldn't have used the function name...)

    I also now realize there must be a preferred way to deliver this data, so anyone is welcome to school me on that, and thanks in advance...

    anyway, hope this helps your kata?

  • rowcased Avatar

    This comment has been hidden.

  • user8436785 Avatar

    Can't translate to Reason, apparently because of too total bonus (numbers overflowing OCaml's limit?). (here is the kumite) Apparently we'll have to change the tests a bit for Reason...

  • user8436785 Avatar

    Wow! Dart is incredibly fast - 3.7 seconds for those huge inputs! :+1: And CoffeeScript with half the Dart size gives 9 seconds... :( Dart translation

  • Unnamed Avatar

    This comment has been hidden.

  • user8436785 Avatar

    I didn't solve it, but I can translate it. Which languages do you want (I can do coffeescript, crystal, elixir, dart, javascript, julia, php, ruby, reason, and typescript)? ;p

  • rowcased Avatar

    hi g964, just a heads up: my code failed ONLY first time I submit on one (1) very large random test. the exact code then passed repeatedly (attempting to study the reason) ...so not sure why it failed that one time.

  • Voile Avatar

    This comment has been hidden.