当前位置:网站首页>-Vector Dot Product-
-Vector Dot Product-
2022-08-10 01:46:00 【-JMY-】
Title description
Vector dot product is a very important operation in linear algebra and computational geometry.
Given two n-dimensional vectors a=(a1,a2,...,an) and b=(b1,b2,...,bn), find the dot product a·b=a1b1+a2b2+...+anbn.
Enter
The first line is an integer n.1 <= n <= 1000.
The second line contains n integers a1,a2,...,an.
The third line contains n integers b1,b2,...,bn.
Adjacent integers are separated by a single space.The absolute value of each integer does not exceed 1000.
Output
An integer, the result of the dot product of two vectors.
Sample input
31 4 62 1 5
Sample output
36
Reference code:
#include
using namespace std;
int n,a[1005],b[1005],s;
int main(){
scanf("%d",&n);
for(int i=0;i
for(int i=0;i
for(int i=0;i
printf("%d",s);
return 0;
}
边栏推荐
猜你喜欢
随机推荐
基于ABP的AppUser对象扩展
redis distributed lock code example
3.1 - 程序设计语言 3.2 - 高级语言的特点及引用 3.3 - 静态/动态类型语言
无源晶振负载电容值CL匹配方法及说明
关于HBuilder X鼠标变为_ 替换字符的问题
【数据存储】signed,unsigned到底怎么区分?如何计算?
go语言的并发原理(goroutine)
The older tester has just passed the "hurdle" of being 35 years old, and I want to tell you something from my heart
渗透测试与攻防对抗——漏洞扫描&逻辑漏洞(Part1)
Web性能测试模型小结
【问题解决】训练和验证准确率很高,但测试准确率很低
阿雷的血压有些低
MATLB|And her ups and downs and finally reached the peak of life [Romantic Journey]
-象棋比赛-
mysql无法远程连接 Can‘t connect to MySQL server on ‘xxx.xxx.xxx.xxx‘ (10060 “Unknown error“)
C language learning journey [operator (incomplete version)]
Kubernetes 60个为什么
基于FPGA的任意字节数的串口接收(含源码工程)
vmware Exsi 网卡配置
重估HR SaaS:一体化后的新三年






![[SUCTF 2019]CheckIn (.htaccess和.user.ini)](/img/43/9e5a501410d2b957969b713d4fe209.png)


