牛客 输入输出 Python
https://blog.csdn.net/qq_39938666/article/details/101004633
牛客
# softmax
import math
import sys
if __name__ == '__main__':
line1 = sys.stdin.readline().strip().split(' ') ## 输入
N = int(line1[0])
K = int(line1[1])
logits_lst = []
for i in range(N):
lst = sys.stdin.readline().strip().split(' ')
logits_lst.append([float(x) for x in lst])
for i in range(N):
line_max = max(logits_lst[i])
index = logits_lst[i].index(line_max)
fenmu = 0
for num in logits_lst[i]:
fenmu += math.exp(num)
fenzi = math.exp(line_max)
p = round(fenzi/fenmu,6)
print(index,' ',p) # 空格输出
import sys
if __name__ == '__main__':
name_lst = sys.stdin.readline().strip().split(' ')
text = sys.stdin.readline().strip()
count = 0
for name in name_lst:
count += text.count(name)
print(count)