[Community Puzzle] Dolbear's Law

https://www.codingame.com/training/easy/dolbears-law

Send your feedback or ask for help here!

Created by @Eldoir,validated by @Deltaspace,@bbb000bbbyyy and @BenjaminUrquhart.
If you have any issues, feel free to ping them.

Hi, @Eldoir

I’ve 2 problems :

  • The first test where the answers are 14.9 and 14.9 => With my code I found 14.9 and 14.4 !! Strange because all other tests are ok ?

  • Second , on submission I don’t pass the “Winter is coming” test ? Is there something special with that one ?

Thanks

Philippe

1 Like

Hi @PhilippeBordmann,
For your first point, since you talk about the “test”, then you know the inputs: it’s probably your solution that isn’t 100% right?
For your second point, I guess you talk about the “validator” because you say “on submission”: then you don’t know the inputs, and I understand how frustrating it is.
If I were you, I would first try to pass all the tests before questioning the validators: you probably got something wrong with your solution.
You can pm me if you want to show me your solution, and maybe I’ll be able to give you a hint about what’s wrong.
Thanks! :slight_smile:

1 Like

Hi,
Have you seen the PM I’ve send ?

Thanks
Philippe

Hi,
No i didn’t see it, sorry!
I answer you right now. :slight_smile:

I found the sames values… do you know what is wrong with 14.4 ?
thx

The value in the second line (in this case 14.9) is calculated like this:

  • You add all integers, you get (except the last one, if the number of integers is odd) -> 8+8+6+3+2+4+8+6+9+5+2+1+5+2+8+8+3+3+6+7+2+8+1+7+4+5+4+2+3+9 = 149
  • You divide the sum by the half number of the values you get -> you get 30 values: 149/15 = 9.933333…
  • You add 5: 9.933333… + 5 = 14.933333…
  • You round it to one decimal place: 14.9

I hope this helps you finding the bug in your program.
If it doesn’t, you can send me a private message with your code, then I can help you better.

4 Likes

thx you for the test case ! i think the rule N8 was a little confused for me :wink:

I can pass all validators but i got stuck at an hour in summer validator(number 5).
I think my code is perfect as per the statement and conditions given in the problem.
It passes all the test cases successfully
Below i have posted my code

import statistics as stats

mean=stats.mean

l=[]

f1=[]

f2=[]

for i in range(int(input())):

    x=list(map(int,input().split()))

    f1.append(10+(sum(x)-40)/7)

    l+=[j for j in x]

x=round(mean(f1),1)

print(x)

if 5<=x<=32:

    x=len(l)

    if x%2!=0:x-=1  #reducing length for odd case

    for i in range(0,x,2):

        f2+=[sum(l[i:i+2])+5]

    print(float(round(mean(f2),1)))

please help this problem has really a lot of time given that all we need to do is find 2 averages…:frowning:

This is your bug, the description says “this is fairly accurate between 5 and 30°C”.

3 Likes

thanx a lot.It was a typo i would never have found out

Hi @everyone,

As many users here, it seems i’m stuck while submitting my code… validators may not pass i guess … but i really don’t figure it out since we 're not aware of inputs…
Can anyone help me please ?

Regards

Could you specify your problem?
What are the validators, your program is failing at?
Could you share parts of your program?

Hi,

Winter is comming validator is not passing while test is OK.

I send you my code in private message :slightly_smiling_face:

Thank you in advance

Select expert mode in option, add this custom validator and show us what it returns:

2
1 0 1 1 0 0 1 0 1 1 1 1 1 1 1
0 1 0 1 1 1 0 1 0 1 0 0 0 0 1

1 Like

Found 5.6
(Excpected 14.9 but doesn’t matyter here :stuck_out_tongue: )

Well itsAFeature solved my issue in private messages (due to code sharing)

It seems that i migth know how to javascript a bit but i don’t know how to read lol

I messed up this
Original text:

On the second line , if the result on the first line is between 5 and 30 (inclusive), then return the average of the estimates calculated every 8

What i understood:

On the second line , if the result of N8 is between 5 and 30 (inclusive), then return TCN8

lol i would have figure it out for a while alone, thank you all

1 Like

thanks man that helped