[Community Puzzle] The alien business of cows

Hi @cedricdd and thanks by advance for your quick reply :+1:

Well, i tried many formulas from internet (like haversine) and still have a big difference with your result : 4100.265 Km
=> delta = 65.202 km !
So, i tried to compute lat & long distances from the degree to Latitude and degree to Longitude formulas in the Help section … 4162.3951284326795 Km => better, but maybe not the right calculi yet :frowning: !

In the other part, when i calculate with your distance, i can find the same time to collect, OK.
→ but still not the same elevation distance : delta = 527m :thinking:

What do you think about, please ? or someone else ?
Thanks a lot for any help … and/or maybe from the author too ?

I’m just using the formulas in the help part:
Lat distance: (missileLatitude - missionLatitude) * 111.11 => (34.756055555556 - 45.922444444444) * 111.11 = -1240.69746944
Long distance: (missileLongitude - missionLongitude) * 111.11 * cos((missileLatitude + missionLatitude) / 2) => (120.62633333333 - 73.712333333333) * 111.1 * cos((34.756055555556 + 45.922444444444) / 2) => 5212.61454 * cos(40.33925) (here the value of the cos is in degree you will need to convert it into radians) => 5212.61454 * cos(0,70405273028) = 3973.18549716
Elev distance is the same for all missions: Missile max alt - missile base elevation => 160 - 0.046 = 159.954

Once you have the 3 distances to find the distance the missile has to travel you just do a √(lat dist² + long dist² + elev dist²)

4 Likes

That was a fun puzzle. :grinning:

1 Like

Hi @Jp82
I can’t answer better than @cedricdd did : use the proposed formulas to calculate the distances, i put them here to help. No need to look for more complicated ways to calculate distances.

1 Like

OK, very good and thanks @cedricdd (and @Razovsky) for your precious help …
→ I changed my code according to your suggestions …
=> and now … 100% pass Tests & Validators :+1: !

Thanks again for this too funny “cows market” :wink:

I was blocked on this for ages today, also failing on only Ferme Majonick in the test cases. It really is about reading the goal carefully - and straight lines. Clever puzzle, shouldn’t have so many negative reviews.

Shouldn’t the gravitational field of earth be defined for the falling bit?

Ok, so it seems like if the missile starts to fall, then that is a lose condition…

1 Like

Hi,

There is one point not that clear (I think would be nice to state to avoid anoying missleading debug) :

  • on which level we should care about the mission altitude,
  • if we consider altitude on its basic definition we should say 160km and 500m are above the mission altitude, so the distance and by the way the time to escape is 159.5km as these are all on the same reference (mission altitude). However, this would mean the complete distance of the missile beofre colision (160km above mission point) needs to care about the distance in between missile launch site altitude and mission altitude.
    We could also state that the max altitude of the missile is reference on sea level but then all above is modified…

Hi !

  • you should care about the mission altitude at every level, it is important to solve it.
  • the max altitude of the missile is 160km above sea level.

Hi,

I know it’s a long time since this puzzle thread hasn’t been updated, but I spotted something weird.

I solved it in Python 3.

In order for my outputs to pass the tests, I had to replace special characters (é, á, etc.).
More specifically, if ? is a special character, I replaced it by ?_?___ (é → é_é___, á → á_á___)

Before that, my code failed for tests 2 and 3.

I found that after doing tests with the custom tester, by trying to write a solution where just the letter ‘é’ was required.

What’s strange is that I tested the solution of some other people who did it in Python 3, and it failed the same way mine failed before I did the change.

Did codingame support special characters in the past, but no longer ? Or have I completely missed something ?

Good puzzle by the way.

Quite the opposite: CodinGame tried to fix the issue of the console not correctly showing special characters in the past. But it seems that they’ve broken something else in the process. I reported the issue to them last week (as it happened to other puzzles too); I guess they’ll probably look into it after the current contest is over.

Alright, thank you.

Similar for typescript today - failed test cases 2 & 3 presumably due to special characters.
Still able to submit and pass validators 100% (without any corrections being applied for special chars).