已经AC
参考:https://blog.dotcpp.com/a/68642 的思路用python写了一遍
参考代码:
def judge(m,q): for i in range(k): if (a[i]-q) <= m: if a[i]<= m: m = a[i] + q -1 else: m = a[i] + q -(a[i] - m) else: return 0 if m < n: return 0 return 1 n,k = map(int,input().split()) a=[0]*k for i in range(k): a[i]=int(input()) a.sort() if (n/k) >=a[0]: q = int(n/k) else: q = a[0] for i in range(q,n+1): m = 0 if judge(m,i)==1: print(2 * (i - 1)) break
0.0分
4 人评分