标签:多少 匹配 abc 货币 过程 人生巅峰 建筑 put 系统
第一题
n = int(input()) for i in range(n): s = input() t1= 1 s1=‘‘ k = 0 s1+=s[0] t0=0 for j in range(1,len(s)): if s[j]==s1[k] and t0<2 and t1<2: s1+=s[j] k+=1 t1+=1 # continue elif s[j]==s1[k] and t0>=2 and t1 == 1: continue elif s[j]==s1[k] and t1>=2: continue else: s1+=s[j] k+=1 t0 = t1 t1 = 1 print(s1)
4
n = int(input()) m = int(input()) for i in range(n): re=[] nums=[] max1 =0 cur=[] for j in range(m): k = list(map(int,input().split())) n1 = k[0] for t in range(n1): if [k[t*2+1],k[t*2+2]] not in re: re.append([k[t*2+1],k[t*2+2]]) nums.append(1) cur.append(j) else: if cur[re.index([k[t*2+1],k[t*2+2]])] ==j-1: nums[re.index([k[t*2+1],k[t*2+2]])]+=1 else: max1 = max(max1,nums[re.index([k[t*2+1],k[t*2+2]])]) nums[re.index([k[t*2+1],k[t*2+2]])] =1 cur[re.index([k[t*2+1],k[t*2+2]])] = j print(max(max1,max(nums)))
6
Z国的货币系统包含面值1元、4元、16元、64元共计4种硬币,以及面值1024元的纸币。现在小Y使用1024元的纸币购买了一件价值为的商品,请问最少他会收到多少硬币?
n = int(input()) a=[1,4,16,64,1024] s=0 j = len(a)-1 n = 1024-n while(n!=0): t = n//a[j] n = n%a[j] #print(a[j],t) s+=t j-=1 print(s)
7
n= int(input()) a = list(map(int,input().split())) j = 0 t=[0]*n if a[0]%2==0: e =a[0]//2 else: e =a[0]//2+1 while True: k=e j=0 while j<len(a) and k>=0: k = 2*k-a[j] j+=1 if j==len(a) and k>=0: break e+=1 print(e)
标签:多少 匹配 abc 货币 过程 人生巅峰 建筑 put 系统
原文地址:https://www.cnblogs.com/SuckChen/p/13197136.html