解题思路:先分成一半再逐个相加并循环判断
注意事项:
参考代码:
N=int(input())
a=list(map(int,input().split()))
b=list(range(100))
count=0
while True:
for i in range(N):
a[i]=a[i]/2
b[i]=a[i]
for i in range(N):
if i==N-1:
a[i]=b[0]+a[i]
else:
a[i]=b[i+1]+a[i]
for i in range(N):
if a[i]%2!=0:
count+=1
a[i]+=1
s=N-1
for i in range(N-1):
if a[i]==a[i+1]:
s=s-1
else:
s=N-1
if s==0:
print(count)
break
0.0分
2 人评分