n, k = map(int, input().split()) a = list(map(int, input().split())) groups = [[] for _ inrange(k)] for i inrange(n): groups[i % k].append(a[i]) min_value = float('inf') for group in groups: total_water = sum(group) bottle_count = len(group) avg = total_water // bottle_count min_value = min(min_value, avg) print(min_value)
n = int(input()) arr = list(map(int, input().split())) ans = 0 hash = [0] * 6 for num in arr: if cnt(num) >= 6: ans += 1 else: hash[cnt(num)] += 1
t = min(hash[5],hash[1]) ans += t hash[5] -= t hash[1] -= t #没拼上的当4考虑 hash[4] += hash[5] hash[5] = 0 t = min(hash[4],hash[1]//2) ans += t hash[4] -= t hash[1] -= t * 2 t = min(hash[4],hash[2]) ans += t hash[4] -= t hash[2] -= t hash[3] += hash[4] hash[4] = 0 t = min(hash[3],hash[2],hash[1]) ans += t hash[3] -= t hash[2] -= t hash[1] -= t t = hash[3] // 2 ans += t hash[3] -= t * 2 hash[2] += hash[3] hash[3] = 0 t = hash[2] // 3 ans += t hash[2] -= t * 3