Ad
  • Custom User Avatar

    As tip for R. Try to use new.env(hash = TRUE)

  • Custom User Avatar

    Is variants like 1^2 -0^2 valid? For n=4 the count of the variants is equal to 3. It will be impossible without them

  • Custom User Avatar

    I cannot turn into a fraction 0.2896412. My prog gave x[1]: "1/4,1/26,1/848,1/2381184,1/21600000000000000" but test
    y[1]: "1/4,1/26,1/848,1/2381184"

  • Custom User Avatar

    It would be better if the argument for R passes as two numbers or a string. As argument passes to the function as float it should transfer to a fraction.
    For some floats it is not a problem. For example 0.75 = 75/100 = 3/4 But 22/23=0.9565217... is impossible to recover to a fraction by floating inferno. Using
    float in the formula leads to floating error

  • Custom User Avatar

    As the result does not obey any rounding rules, so I cannot code it. There are some rules: to nearest integer, to even. At last I can throw out extra digits.
    But no one works. Ok. it needed to substract the final balance from the start balance and divide on count of items

  • Custom User Avatar

    The version of R is very old here. In 4.0 rounding was corrected.

    There are other ways.

  • Custom User Avatar

    The version of R is very old here. In 4.0 rounding was corrected. I do not see how I can solve it. Rounding for .xx5 is not predictable. 26.575 rounds to 26.57 but 23.175 to 23.18. Mean gives the same result as the simple division sum on count of the elements.

  • Custom User Avatar

    Are you sure to correctly interpret the results of the tests?

  • Custom User Avatar

    Please when you post an issue give the test you think it is wrong (with the input, your output and the expected result) otherwise it is impossible to answer.

  • Custom User Avatar

    Please, check random tests for R. Some test are wrong. After five attempts I could submit my solving of this problem.
    I checked the top decision in RStudio. And for wrong test I got the value that was equal to the value from my script

  • Custom User Avatar

    I am sorry. Yes, it was R.
    For example. For "CB02546520010" I got a mistake

    Test Failed
    act not equal to n.
    1/1 mismatches
    [1] 6188056489 - 5190136489 == 997920000

    koeff Factorial mult=koeff*factorial
    0 0 1,00 0,00
    1 1 1,00 1,00
    2 0 2,00 0,00
    3 0 6,00 0,00
    4 2 24,00 48,00
    5 5 120,00 600,00
    6 6 720,00 4320,00
    7 4 5040,00 20160,00
    8 5 40320,00 201600,00
    9 2 362880,00 725760,00
    10 0 3628800,00 0,00
    11 11 39916800,00 439084800,00
    12 12 479001600,00 5748019200,00

    Sum of the last column is 6188056489
    I do not see any mistakes.
    Sorry. Table appears only during the edit

  • Custom User Avatar

    You should always mention the language you're working with (in this case it's R?). For the input you gave the expected result is 12265933929 indeed, so maybe you misinterpreted the logs somehow.

    The R translation seems to around for a while with a few solves, so someone would've noticed if it was wrong.

  • Custom User Avatar

    I'm sorry, but some tests do not pass by. I checked them in Excel and results were equals to mine. According to the internet references
    '1C731550201110' may be presented as 0x0! + 1x1!+ 1x2!+1x3!+0x4!+2x5!+0x6! +5x7!+5x8! + 1x9! + 3x10!+7x11!+12x12!+1x13!
    Sum of this equation is equal to 12265933929. But test gave me 11307930729. What's wrong?