6. tennis
何も考えず実装。392byte。
p1 = p2 = 0 while(1): s = raw_input() if s == '1': p1 += 1 elif s == '2': p2 += 1 if p1 > p2: if p1 == 7: print 'Player1 wins the set %d - %d' % (p1, p2) break print 'Player1 leads %d - %d' % (p1, p2) elif p1 < p2: if p2 == 7: print 'Player2 wins the set %d - %d' % (p2, p1) break print 'Player2 leads %d - %d' % (p2, p1) else: print 'Set is tied at %d' % p1
縮めてみた。223byte。
_1=_2=0;w=' wins the set 7 - %d';l=' leads %d - %d';p='Player' while(1):vars()['_%d'%input()]+=1;print{1:{7:p+'1'+w%_2}.get(_1,p+'1'+l%(_1,_2)),0:'Set is tied at %d'%_1,-1:{7:p+'2'+w%_1}.get(_2,p+'2'+l%(_2,_1))}[cmp(_1,_2)]
見にくい上にPython部門ランキングでダントツビリ。うーむ。