为什么有些测试点怎么都过不去啊,到底哪里错了,求大神
查看原帖
为什么有些测试点怎么都过不去啊,到底哪里错了,求大神
1277415
lnk18805909556楼主2024/5/15 21:08

def is_jolly(nums): n=nums[0] differences=set() for i in range(1,n): difference=abs(nums[i]-nums[i-1]) if 1<=difference<=n-1: differences.add(difference) else: return False return len(differences) nums=list(map(int,input().split(' '))) if is_jolly(nums): print('Jolly') else: print('Not jolly')

2024/5/15 21:08
加载中...