当前位置:网站首页>1009 Product of Polynomials C语言多项式乘积(25分)
1009 Product of Polynomials C语言多项式乘积(25分)
2022-08-09 10:48:00 【Cutecumber】
1009 Product of Polynomials (25分)
#include <iostream>
using namespace std;
double poly1[1001];
double poly2[1001];
double multiply[2002];
int main(){
int n1, n2;
int index;
int count = 0;
cin >> n1;
for(int i=0; i<n1; i++){
cin >> index;
cin >> poly1[index];
}
cin >> n2;
for(int i=0; i<n2; i++){
cin >> index;
cin >> poly2[index];
}
for(int i=0; i<1001; i++){
if(poly1[i] != 0){
for(int j=0; j<1001; j++){
if(poly2[j] != 0){
multiply[i+j] += poly1[i] * poly2[j];
}
}
}
}
for(int i=2002; i >= 0 ; i--){
if(multiply[i] != 0)
count++;
}
cout << count;
for(int i=2002; i >= 0 ; i--){
if(multiply[i] != 0)
printf(" %d %.1lf", i, multiply[i]);
}
return 0;
}
边栏推荐
- cnn的输入输出
- 深度学习--循环神经网络(Recurrent Neural Network)
- Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings
- 自从我使用HiFlow场景连接器后,在也不用担心成为“落汤鸡”了
- [Error record] Solve the problem that ASRock J3455-ITX cannot be turned on without a monitor plugged in
- 华为VRRP+MSTP联动接口检测实验案例
- TensorFlow:NameError: name ‘input_data’ is not defined
- Unix Environment Programming Chapter 15 15.7 Message Queuing
- 性能测试(06)-逻辑控制器
- PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization Paper Reading
猜你喜欢
深度学习--生成对抗网络(Generative Adversarial Nets)
The complete grammar of CSDN's markdown editor
OneNote 教程,如何在 OneNote 中搜索和查找笔记?
深度学习--自编码器(AutoEncoder)
OpenSSF的开源软件风险评估工具:Scorecards
linux mysql操作的相关命令
机器学习-逻辑回归(logistics regression)
shell脚本实战(第2版)/人民邮电出版社 脚本2 验证输入:仅限字母和数字
编解码(seq2seq)+注意机制(attention) 详细讲解
性能测试(03)-JDBC Request
随机推荐
unix系统编程 第十五章 15.2管道
jmeter BeanShell 后置处理器
力扣(LeetCode)220. 存在重复元素 III(2022.08.08)
用Word写代码
商业技术解决方案与高阶技术专题 - 数据可视化专题
caffe ---make all编辑出错
unix环境编程 第十五章 15.6 XSI IPC
cesium加载地图
cnn的输入输出
ESIM(Enhanced Sequential Inference Model)- 模型详解
机器学习--线性回归(Linear Regression)
shap库源码和代码实现
BERT预训练模型(Bidirectional Encoder Representations from Transformers)-原理详解
autogluon安装,使用指南,代码
Getting Started with MNIST Machine Learning
unix环境编程 第十五章 15.5FIFO
Oracle数据库常用函数总结
How tall is the B+ tree of the MySQL index?
The torch. The stack () official explanation, explanation and example
我用开天平台做了一个定时发送天气预报系统【开天aPaaS大作战】