# 5조 실습문제
import numpy as np
import matplotlib.pyplot as plt
c = int(input('케이스 개수 입력 '))
for i in range(c) :
arr = list(input().split())
N = float(arr[0])
scores = np.array(arr[1:],int)
avg = scores.mean()
num = np.where(scores > avg)[0].size
print(round(num/N*100,3),"%")
x = np.arange(scores[np.argmin(scores)],scores[np.argmax(scores)]+10,10)
y = list()
for score in x :
tmp = np.where(scores == score)[0].size
y.append(tmp)
plt.bar(x,y)
plt.show()
y.clear()
# 6조 1
import numpy as np
vec = np.array([2,4,6,8,9,15],int)
two_dim_vec = vec.reshape(2,3)
print(two_dim_vec)
#6조 2
import numpy as np
A = np.array([[2,3],[5,6]])
B = np.array([4,5])
C = np.linalg.inv(A)
ans = C @ B
print(ans)
#6조 3
import numpy as np
arr = list(input().split())
N = int(input())
ages = np.array(arr,int)
M = 24 / N
groups = ages.reshape(-1,N)
for group in groups :
print(group[np.argmax(group)],group[np.argmin(group)])