python求助!80分测试点一总WA

P5719 【深基4.例3】分类平均

igopor @ 2024-11-03 11:28:05

n,k=map(int,input().split(" "))

l1=[]

l2=[]

for i in range(2,n):

if i%k==0:

    l1.append(i)

else:

    l2.append(i)

m=0

t=0

for l in l1:

m=m+l

for l in l2:

t=t+l

q=m/len(l1)

p=t/len(l2)

print(f"{float(q):.1f} {float(p):.1f}")


by can_i_ @ 2024-11-10 21:34:44

range(1, n+1) 从1到n,1和n都得包括


by igopor @ 2024-11-16 08:31:12

@cani 过了!谢谢佬!!!!!


|