博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pat1009
阅读量:4612 次
发布时间:2019-06-09

本文共 1499 字,大约阅读时间需要 4 分钟。

1009. Product of Polynomials (25)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

This time, you are supposed to find A*B where A and B are two polynomials.

Input Specification:

Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2 ... NK aNK, where K is the number of nonzero terms in the polynomial, Ni and aNi (i=1, 2, ..., K) are the exponents and coefficients, respectively. It is given that 1 <= K <= 10, 0 <= NK < ... < N2 < N1 <=1000.

 

Output Specification:

For each test case you should output the product of A and B in one line, with the same format as the input. Notice that there must be NO extra space at the end of each line. Please be accurate up to 1 decimal place.

Sample Input
2 1 2.4 0 3.22 2 1.5 1 0.5
Sample Output
3 3 3.6 2 6.0 1 1.6 多项式乘法
#include
#include
#include
#include
#include
using namespace std;struct node{ int cishu; double xishu;}a[2200];double a1[2200];int main(){ for(int i=0;i<2200;i++) { a1[i]=0.0; } int n; cin>>n; for(int i=0;i
>a[i].cishu>>a[i].xishu; } int m; cin>>m; int mx=-1; for(int i=0;i
>q>>w; for(int j=0;j
mx) mx=b; } } int flag=0; for(int i=0;i<=mx;i++) { if(a1[i]!=0) { flag++; } } cout<
=0;i--) { if(a1[i]!=0) { cout<<" "<

 


转载于:https://www.cnblogs.com/2014slx/p/7800164.html

你可能感兴趣的文章
python的沙盒环境--virtualenv
查看>>
软件自动化测试——入门、进阶与实战
查看>>
BZOJ1878 [SDOI2009]HH的项链 树状数组 或 莫队
查看>>
BZOJ3675 [Apio2014]序列分割 动态规划 斜率优化
查看>>
2016.10.24 继续学习
查看>>
产品功能对标 - 服务授权管理
查看>>
各地IT薪资待遇讨论
查看>>
splay入门
查看>>
带CookieContainer进行post
查看>>
C语言学习笔记--字符串
查看>>
CSS-上下文选择器
查看>>
ionic repeat 重复最后一个时要执行某个函数
查看>>
1.初识代码审计-基础
查看>>
[Vue-rx] Stream an API using RxJS into a Vue.js Template
查看>>
解决VC几个编译问题的方法——好用
查看>>
SPOJ #11 Factorial
查看>>
City Upgrades
查看>>
“人少也能办大事”---K2 BPM老客户交流会
查看>>
关于七牛进行图片添加文字水印操作小计
查看>>
DataSource数据库的使用
查看>>