An accurate solution is not possible from the input data unless it is known how the individual games from each match turned out.

For example in the Kasparov Karpov match the score 2.0-2.0 could be a result of.

KasparovKarpov
win 2 lose 2win 2 lose 2
win 1 draw 2 lose 1win 1 draw 2 lose 1
win 0 draw 4 lose 0win 0 draw 4 lose 0

Each of these will produce the 2.0-2.0 score from the excersize. Of course, pointing this out to your teacher may not improve your grade. I guess you could code the excersize to print out all the possible variations for each score but this will cause the summary scores at the end to vary over a wide range indeed since for this one match they could each have 0,1, or 2 wins, 0,1 or 2 losses, or 0, 2, or 4 draws with a couple these combined in the middle...

One consolation, is that the .5 scores have to have an odd number of draws and the .0 scores have to have an even number of draws.


In reply to Re: Stuck with hw by dga
in thread Stuck with hw by dirtyboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.