PTA L1-055:谁是赢家 (python)

阅读 125

2022-03-11

一、题目要求

在这里插入图片描述
在这里插入图片描述

二、参考代码

n=[int(i) for i in input().split()]
s=input()
if s.count(str(n.index(max(n))))>0:
    if n.index(max(n))==0:
        print('The winner is a: %s + %d'%(n[0],s.count('0')))
    else:
        print('The winner is b: %s + %d'%(n[1],s.count('1')))
else:
    if n.index(min(n))==0:
        print('The winner is a: %s + %d'%(n[0],s.count('0')))
    else:
        print('The winner is b: %s + %d'%(n[1],s.count('1')))

精彩评论(0)

0 0 举报