This question was meant to imply something like:
If a scientist tests an antibiotic on five people, but it ends up killing each one before being perfected. Then it goes on to save millions of lives.
Do the ends justify the means?
Quite a different question from the first one, actually.
But let's take this question.
Even if MY answer were: Yes, that particular end would justify that particular means to the end...
...my guess would be that the answer of the five individuals and their family and loved ones might be appreciably different.
And if I could introduce variables like: "Could the scientists get volunteers for what was acknowledged to be a very dangerous testing?"...my response would be affected (effected).
In fact, your proposition does not suggest if the five were volunteers entering the testing with the shades up, so to speak -- or were people duped into a test they did not know was dangerous.
The responses might be different considering answers to those variables.
There have been times where people have died in testing -- in fact where most have died (heart transplants) -- and great future good was derived. They knew the dangers before the surgeries.
To me, the sacrifice made by the original VOLUNTEERS was certainly a means that justified the ends.
Some drugs were administered in tests back in the 1950's without the informed consent (indeed, without the consent, informed or not) of the testees.
Even if good were derived from that kind of underhanded undertaking -- and even if it could be shown that the testing was needed, but could not be obtained by volunteers, I would probably vote that kind of means not justifying that kind of end.