201712-1 最小差值
满分实现:
n = int(input())
data = list(map(int,input().split()))
data_sort = sorted(data)
cha = []
for i in range(1,n):
cha.append(abs(data_sort[i]-data_sort[i-1]))
print(min(cha))
201712-2 游戏
满分实现:
n,k = map(int,input().split())
child = [1]*n
def judge(number):
if number % k == 0 or list(str(number))[-1] == str(k):
return -1
else:
return 1
number = 0
i = 0
while child.count(1) > 1:
if child[i]==1:
number += 1
result = judge(number)
if result == 1:
pass
else:
child[i]= -1
i+=1
i = i % n
print(child.index(1)+1)