Sunday Times Teaser 2494 – No Title
by Danny Roth
Published July 11 2010 (link)
George and Martha’s council has 40 seats shared between Labour, Conservatives and Democrats. Before a recent election, Labour had an overall majority, with Conservatives second. After it, the order was Conservatives first, Labour second, Democrats third, both Conservatives and Democrats having improved their numbers of seats. To achieve a majority, the Conservatives formed a coalition with the Democrats. Each party had a whole two-figure number percentage change in its number of seats; the Democrats’ percentage increase was an odd number.
How many seats did each party win?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617181920212223242526272829303132# Conservative seats before the electionfor c1 in range(1, 41):# Democrat seats (less than the Conservatives)for d1 in range(1, min(c1, 41 - c1)):# Labour seatsl1 = 40 - (c1 + d1)# Labour has an overall majorityif l1 <= c1 + d1:continue# the Conservatives gain seats in the electionfor c2 in range(c1 + 1, 41):# as do the Democratsfor d2 in range(d1 + 1, min(c2, 41 - c2)):l2 = 40 - (c2 + d2)# Conservatives first, Labour second; Democrats third;# the Conservatives need a coalition with the Democrats# to gain an overall majorityif not (d2 < l2 < c2 and c2 < d2 + l2 and c2 + d2 > l2):continue# now find the percentage change in the seats for each Partyz = zip((c1, d1, l1), (c2, d2, l2))pc = [divmod(100 * abs(y - x), x) for x, y in z]# all percentages are two digit integersif all(9 < x[0] < 100 and x[1] == 0 for x in pc):# and the Democrat percentage is oddif pc[1][0] & 1:print(f'Con {c2}(+{c2-c1}), Lab {l2}(-{l1-l2}), Dem {d2:2}(+{d2-d1})')