接下来我们用Python进行编程:
import numpy as np
y = input() #第一行数据
y_p = input() #第二行数据
y = [int(x) for x in y.split(",")]
y_p = [int(x) for x in y_p.split(",")]
result = 0.0
'''
计算结果放入result中,并打印出来即可print(result)
'''
n = len(y)
count = 0
sumcount = 0
for i in range(n):
if y[i] == 1 and y_p[i] == 1:
count = count + 1
sumcount = sumcount + 1
elif y[i] == 1:
sumcount = sumcount + 1
result = count / sumcount
print(result)