当前位置:网站首页>-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;
}
边栏推荐
- 深入理解Aarch64内存管理
- Creo5.0入门教程赠素材
- [C language] In-depth understanding of pointers and arrays (issue 4)
- 第十二,十三章 mysql数据类型,视图的课后练习
- Linux安装Oracle和postgrepSQL数据库
- [SUCTF 2019]CheckIn (.htaccess和.user.ini)
- 使用C语言实现静态链表
- 快速响应性智能型/智能响应性聚乙二醇纳米/还原响应型水凝胶的研究与制备
- 安全知识培训——消防安全
- CST Studio Suite 2021 software installation package and installation tutorial
猜你喜欢

02|运算符

2022金九银十工作潮,怎么样才能成功跳槽面试拿到高薪呢?

深入理解Aarch64内存管理

由生物素参与的D-Biotinol,CAS号:53906-36-8具体特性说明

西安生物素-四聚乙二醇-酰胺-4苯酚 浅黄色半固态

ES6 Beginner to Mastery #13: Extension Methods for Arrays 2

flask——请求、响应、请求扩展、session、闪现、蓝图、g对象、flask-session

收银管理软件如何做好员工管理?

服装店管理系统如何推送活动?

LSTM-based distributed energy generation prediction (Matlab code implementation)
随机推荐
Service Discovery @EnableDiscoveryClient
Linux安装Oracle和postgrepSQL数据库
【问题解决】训练和验证准确率很高,但测试准确率很低
03|流程控制
WPF DataGrid 使用数据模板
走出迷宫的最少步数2
JVM Memory and Garbage Collection - 10. Direct Memory
Web性能测试模型小结
NTP SERVICE TASK 在GWserver配置、启用NTP服务,为当前环境提供时钟同步服务,Client主机可以从该服务器同步时间。
【C语言】通讯录《静态内存版本》
[C language] In-depth understanding of pointers and arrays (issue 4)
【数据存储】signed,unsigned到底怎么区分?如何计算?
Leetcode83. 删除排序链表中的重复元素
Koa中间件next实现
Enhanced Deep Residual Networks for Single Image Super-Resolution
2022中高级Android面试题汇总来助你通过面试
[SSH]如何敲一条线
温度响应性纳米水凝胶光子品体/纤维素修饰荧光水凝胶/载脂质体水凝胶的制备方法
地雷数量求解
Creo5.0 introductory tutorial free material