当前位置:网站首页>-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;
}
边栏推荐
猜你喜欢
收银管理软件如何做好员工管理?
dlopen failed: library "libtaml.so" not found
The technical aspects of the byte have been passed, and the salary has been negotiated for 20K*13, but the result is still being brushed. I asked the HR why...
线程的同步与互斥
2022中高级Android面试题汇总来助你通过面试
Leetcode79. 单词搜索
【剑指offer】第一题 第二题
手把手教你编写性能测试用例
【问题解决】训练和验证准确率很高,但测试准确率很低
MATLB|和她跌宕起伏最终到达人生之峰【浪漫旅途】
随机推荐
游泳馆系统次卡的设置有哪些细节?
3.1 - 程序设计语言 3.2 - 高级语言的特点及引用 3.3 - 静态/动态类型语言
Leetcode79. 单词搜索
移动终端数据业务高安全通信方案研究
第十五章 mysql存储过程与存储函数课后练习
WPF DataGrid 使用数据模板
ETCD快速入门-02 ETCD安装
考柏的感慨
Copper's emotion
为什么不建议你在 Docker 中跑 Mysql ?
Next.js获取路由参数及styled-jsx 的使用
CAS:183896-00-6 (Biotin-PEG3-C3-NH2) PEG衍生物
深度剖析 Apache EventMesh 云原生分布式事件驱动架构
分形网络(FractalNet)----学习笔记
Solidity 智能合约入门
GoLang 使用 goroutine 停止的几种办法
Service Discovery @EnableDiscoveryClient
Kubernetes 开发环境比对
Kubernetes YAML编写 讲解
dlopen failed: library "libtaml.so" not found