# [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!

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.

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

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â€¦

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

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 )

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