why??
查看原帖
why??
472885
WhtshpBlkhse楼主2023/6/28 15:54

向量点积计算

https://www.luogu.com.cn/problem/B2091 在线性代数、计算几何中,向量点积是一种十分重要的运算。

给定两个 n维向量 a = (a1, a2,..., an) 和 b = (b1, b2,..., bn),求 点积 a · b = a1b1 + a2b2 +...+ anbn。

拓展——什么是点积? https://baike.baidu.com/item/%E7%82%B9%E7%A7%AF/9648528?fr=ge_ala

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = sum(a[i] * b[i] for i in range(0, n))
print(ans)
2023/6/28 15:54
加载中...