X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=blobdiff_plain;f=partition.py;h=4e2766d253c9b54bddf71fd23c5fb334c298e735;hp=b539d32ec38b8d97c902c2872109d0428aa18179;hb=83522686e4bd5f0a877f3adf5d94e3b351a774f6;hpb=c6c68d95229bc743b79f9f9ed813dfd9cce34df0 diff --git a/partition.py b/partition.py index b539d32..4e2766d 100755 --- a/partition.py +++ b/partition.py @@ -145,10 +145,10 @@ def search_and_report(n, m): d = best[1] print "%d into %d best min fragment found: %s" % (n, m, best[0]) print " Cut up %d sticks of length %d like this:" % (n, m) - for row, count in sorted(best[2].items(), reverse=True): + for row, count in sorted(best[3].items(), reverse=True): print " %d x (%s)" % (count, " + ".join([str(Fraction(k,d)) for k in row])) print " Reassemble as %d sticks of length %d like this:" % (m, n) - for col, count in sorted(best[3].items(), reverse=True): + for col, count in sorted(best[2].items(), reverse=True): print " %d x (%s)" % (count, " + ".join([str(Fraction(k,d)) for k in col])) def main():