1,字符串的翻转问题,ac
while True: try: s = input() if s==s[::-1]: n = len(s) flag = True res = ['A','H','I','M','O','T','U','V','W','X'.'Y'] for i in range(n//2+1): if s[i] not in res: flag = False break if flag==True: print('YES') else: print('NO') else: print('NO') except: break2 魔塔游戏 ac
n = int(input()) list1 = [] list2 = [] for i in range(n): nums = list(map(int,input().split())) if nums[1]==0: list1.append(nums) else: list2.append(nums) list2 = sorted(list2,reverse=True) sum1 = 0 for key in list1: sum1+=key[0] for key in list2: if sum1+key[0]>sum1*2: sum1+=key[0] else: sum1*=2 print(sum1)
全部评论
(1) 回帖