思路:模拟题。根据题意进行模拟,最终输出结果即可
代码:
import sys
input = lambda: sys.stdin.readline().strip()
import math
inf = 10 ** 18
def I():
return input()
def II():
return int(input())
def MII():
return map(int, input().split())
def GMI():
return map(lambda x: int(x) - 1, input().split())
def LI():
return input().split()
def LII():
return list(map(int, input().split()))
def LFI():
return list(map(float, input().split()))
fmax = lambda x, y: x if x > y else y
fmin = lambda x, y: x if x < y else y
isqrt = lambda x: int(math.sqrt(x))
'''
'''
def solve():
n, m = MII()
right = I()
name = []
res = []
for i in range(2 * m):
s = I()
if i & 1:
res.append(s)
else:
name.append(s)
mx, ans = 0, "z" * 51
for i in range(m):
cnt = 0
for j in range(n):
if right[j] == res[i][j]:
cnt += 1
if cnt > mx or (cnt == mx and name[i] < ans):
mx = cnt
ans = name[i]
print(ans)
print(f"{mx * (100 / n):.2f}")
t = 1
# t = II()
for _ in range(t):
solve()

京公网安备 11010502036488号