#174

I find already my way and solve it

#175

Good puzzle, but i think, this should be mentioned in puzzle , during specific second when light switches from red to green, your vehicle is allowed to move, but when light switches from green to red your vehicle canāt move aheadā¦
e.g suppose lightDuration is 10 secondsā¦
so at 10th second, light switches from green to red, so vehicle canāt move ahead,
but at 20th second, light switches from red to green, so your vehicle can move aheadā¦

#176

Hi. In test case number 5, my program gets 79 km/h or 21.8 m/s. why is this the wrong answer?

first light: 300m 30s: 300 / 21.8 = 14s
second light: 1500m 20s: (1500 + 300) / 21.8 = 83s. green light in the following intervals:
0-19, 40-59, 80-99.
third light: 3000m 10s: (3000 + 1500 + 300) / 21.8 = 220s. green light in the following intervals:
0-9, 20-29, 40-49, 60-69, 80-89, 100-109, 120-129, 140-149, 160-169, 180-189, 200-209, 220-229

#177

Fun puzzle!

#178

How are you doing that? I have ugly 1e-5 error comparison.

#179

Hello there,
I did this test in PhP, and I run into some problem when trying my modulo ^^ā
German traffic donāt pass ( iām supposed to find 60 when I have 20 on max speed), but itās due to my code giving me (60/15) % 2 =1 ! 4%2 should give me 0, damn itā¦
I also tried bit wise, (\$tmpModulo&1)===0, but I have the same problem.

Iām honestly lost as to why this doesnāt workā¦ Also tried intdiv, fmod functions too, by the wayā¦
Thank you kindly to anyone understanding my mistake ^^"

Ben