n, m =eval(input())
height = n
count =0
distance = height
# 如果弹起来的高度(弹之前/2) 大于 最小弹起高度:则弹
t =0.0while height /2>0.01:# 弹
height /=2
count +=1#print("第%d次弹起来的高度是%f." % (count, height))
distance += height *2# 累加起、落距离if count == m:
t = distance-height
#print("第%d次弹起来的高度是%f." % (count, distance))print("小球全程弹起{:d}次,移动了{:.2f}米。反弹第{:d}次时,移动了{:.2f}米。".format(count,distance,m,t))
二、列表元素绝对值排列
defdx(x):returnabs(x)
a =input().split(" ")
s1 =[int(a[i])for i inrange(len(a))]
s1.sort(key=dx)print(s1)
三、列表合并去重
a =input().split(" ")
b =input().split(" ")
s1 =[int(i)for i in a]
s2 =[int(i)for i in b]
s1.extend(s2)
s1 =list(set(s1))print(s1)
四、删除字符串中连续的重复字符
s =input()print(s[0],sep="",end="")for i inrange(1,len(s)):if s[i]==s[i-1]:continueelse:print(s[i],sep="",end="")
五、乘积的列表
a =input().split(" ")
s1 =[]for i inrange(len(a)):
s1.append(int(a[i]))
s2 =[]
d1 =1
d2 =1for i inrange(len(s1)):if s1[i]==0:
d2 = d2*s1[i]else:
d1 = d1*s1[i]
cnt = s1.count(0)if cnt==1:for i inrange(len(s1)):if s1[i]==0:
t = d1
else:
t =int(d2/s1[i])
s2.append(t)elif cnt>1:
t =0for i inrange(len(s1)):
s2.append(t)elif cnt==0:for i inrange(len(s1)):
t =int(d1/s1[i])
s2.append(t)print(s2)
六、0的组合
a =sorted(list(map(int,input().split())))
l =len(a)
b =set()for i inrange(l):for j inrange(i+1,l):for k inrange(j+1,l):if a[i]+a[j]+a[k]==0:
b.add((a[i],a[j],a[k]))print(len(b))
七、矩阵翻来覆去的运算
n=int(input())
a=[]sum=0for i inrange(n):
s=input()
le =len(s)
a.append([int(n)for n in s.split()])if le !=2*n-1:print("输入错误,请重新输入!")else:for i inrange(n):for j inrange(n):if i != n -1and j != n -1and i + j != n -1:sum+= a[i][j]print(sum)
n=int(input())
a=[]sum=0for i inrange(n):
s =list(map(int,input().split()))
a.append(s)iflen(a[0])!= n:print("输入错误,请重新输入!")else:for i inrange(n):for j inrange(n):if i != n -1and j != n -1and i + j != n -1:sum+= a[i][j]print(sum)
a =input().split(",")
s1 =[]for i inrange(len(a)):
s1.append(int(a[i]))
d={}for i in s1:if i in d:
d[i]+=1else:
d[i]=1
res =[]for i in d:if i +1in d:
res.append(d[i]+d[i+1])ifnot res:print(0)else:print(max(res))
十、分糖果
m, n =map(int,input().split())
res =[]for i inrange(n):
res.append(0)
i =0while m >0:
res[i % n]+=min(i +1, m)
m -= i +1
i +=1print(res)