PTA 乙级 1039 到底买不买 (20分) Python

 没有试出测试点,直接看代码吧

Python

 1 vendor = input()   
 2 xh = input()
 3 v = list(vendor)
 4 no = 0
 5 for i in xh:
 6     if( i in v):
 7         v.remove(i)     #出现过的珠子要减去     
 8     else:
 9         no += 1      
10 if no == 0:
11     print("Yes {}".format(len(vendor) - len(xh)))   #多余珠子就是摊贩珠子数目减小红想要珠子数
12 else:
13     print("No {}".format(no))

猜你喜欢

转载自www.cnblogs.com/SCP-514/p/13383149.html
今日推荐