当前位置:网站首页>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;
}
边栏推荐
- unix环境编程 第十四章 14.8 存储映射I/O
- 详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
- 数据存储:对dataframe类,使用to_csv()将中文数据写入csv文件
- 985毕业,工作3年,分享从阿里辞职到了国企的一路辛酸和经验
- json库的dumps()方法和loads()方法
- TensorFlow:NameError: name ‘input_data’ is not defined
- 1005 继续(3n+1)猜想 (25 分)
- 乘积量化(PQ)
- 性能测试(04)-表达式和业务关联-JDBC关联
- Pyhton实战汇总篇
猜你喜欢

How tall is the B+ tree of the MySQL index?

prometheus接入mysqld_exporter

shap库源码和代码实现

OpenSSF的开源软件风险评估工具:Scorecards

深度学习--自编码器(AutoEncoder)

华为VRRP+MSTP联动接口检测实验案例

activemq 消息持久化

Shell script combat (2nd edition) / People's Posts and Telecommunications Press Script 2 Validate input: letters and numbers only

Netscope:神经网络结构在线可视化工具

jmeter BeanShell 后置处理器
随机推荐
pip common commands and changing source files
faster-rcnn学习
非科班毕业生,五面阿里:四轮技术面+HR一面已拿offer
MySQL外键在数据库中的作用
CSDN的markdown编辑器语法完整大全
torch.cat()函数的官方解释,详解以及例子
相伴成长,彼此成就 用友U9 cloud做好制造业数智化升级的同路人
深度学习--生成对抗网络(Generative Adversarial Nets)
性能测试(04)-表达式和业务关联-JDBC关联
UNIX Environment Programming Chapter 15 15.5FIFO
shell脚本实战(第2版)/人民邮电出版社 脚本2 验证输入:仅限字母和数字
Transformer+Embedding+Self-Attention原理详解
Dialogue with the DPO of a multinational consumer brand: How to start with data security compliance?See you on 8.11 Live!
华为VRRP+MSTP联动接口检测实验案例
unix环境编程 第十五章 15.7消息队列
PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization论文阅读
在webgis中显示矢量化后的风险防控信息
MySQL索引的B+树到底有多高?
cesium加载地图
Unix Environment Programming Chapter 15 15.7 Message Queuing