博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1009. Product of Polynomials (25)
阅读量:7060 次
发布时间:2019-06-28

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

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

 

1 #include
2 #include
3 #include
4 5 double str1[1001],str2[1001],ans[2002]; 6 int main() 7 { 8 int n,m,zi,xi,cnt=0; 9 int i,j;10 scanf("%d",&n);11 for( i=0; i
=0; i--)36 {37 if( ans[i])38 printf(" %d %.1f",i,ans[i]);39 }40 return 0;41 }

 

转载于:https://www.cnblogs.com/yuxiaoba/p/8543394.html

你可能感兴趣的文章
实用算法实现-第 11 篇 贪心算法
查看>>
MongoDB的介绍、安装和使用
查看>>
闭包最常用的三种用法
查看>>
问题总结
查看>>
Ubuntu Mac 主题
查看>>
Django - 创建多对多及增加示例
查看>>
文档碎片恢复
查看>>
testNG框架,使用@BeforeClass标注的代码,执行失败不抛出异常,只提示test ignore的解决方法...
查看>>
[C++基础]020_C++0x新特性之右值引用(int&& value)
查看>>
java高并发之CountDownLatch,CyclicBarrier和join
查看>>
【简易版】IOS仿periscope自制狂赞飘桃心
查看>>
xss其他标签下的js用法总结大全
查看>>
《图像处理实例》 之 寻找图纸标注
查看>>
3的幂的和
查看>>
Maximum Value(CodeForces - 484B)
查看>>
ASP_NET Global_asax详解
查看>>
hdu2067 小兔的棋盘 DP/数学/卡特兰数
查看>>
Ubuntu文件模式之设定笔记
查看>>
H.264中的一些问题总结
查看>>
转:IIS虚拟目录实现与文件服务器网络驱动器映射共享
查看>>