1009:多项式乘积。
Sample Input
2 1 2.4 0 3.2
2 2 1.5 1 0.5
Sample Output
3 3 3.6 2 6.0 1 1.6
用数组保存。如果稀疏的话有点费内存。。。
#include<iostream>
using namespace std;
#include<memory.h>
#include<stdio.h>
double a[1001];
double b[1001];
double res[2001];
int main()
{
int n;
int index;
cin>>n;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(res,0,sizeof(res));
while(n--)
{
cin>>index;
cin>>a[index];
}
cin>>n;
while(n--)
{
cin>>index;
cin>>b[index];
}
for(int i=0;i<1001;i++)
for(int j=0;j<1001;j++)
{
res[i+j]+=a[i]*b[j];
}
int count=0;
for(int i=0;i<2001;i++)
{
if(res[i]!=0)
count++;
}
cout<<count;
for(int i=2000;i>=0;i--)
{
if(res[i]!=0)
printf(" %d %.1f",i,res[i]);
}
}
分享到:
相关推荐
13623-calculate-roots-of-chebyshev-polynomials.zip.zip
B型和D型极大抛物型Kazhdan-Lusztig R-多项式,范久瑜,,在本文中,我们给出了某些$B$型和$D$型极大抛物型Kazhdan-Lusztig $R$-多项式的显式表达式。记$B_n$为$B$型Coxeter群,生成元集记为$S_n^B={s_0,s_1,ldot
建立两个链表为稀疏多项式,将他们每项按项相加,最后将得到的链表打印出来。
多项式相加 数学上使用行列式来解决 可以使用克拉默法则来写
Coxeter群上Eulerian多项式的强$q$-对数凸性,刘丽,祝宝宣,本文借助指数发生函数,得到了Coxeter群上Eulerian多项式的强$q$-对数凸性,其证明方法基于指数Riordan矩阵和证明多项式序列具有强$q$-对数凸�
Two-variable Hermite polynomials as time-evolutional transition amplitude for driven harmonic oscillator,范洪义,江腾飞,For the two-variable Hermite polynomials Hm,n(β,β*),we find its new physical...
Computing Roots of Polynomials ,采用数值方法求根,速度快,很好
This book tells how Euler introduced the idea of orthogonal polynomials and combined the two subjects, and how Brouncker's formula of 1655 can be derived from Euler's efforts in Special Functions and...
Multi-Client Verifiable Computation Service of Polynomials on Outsourced Data
- Calcution of the entropy of a time series - Non-linear analysis (3rd order statistics) - Test for UnitCircle- and Hurwitz- Polynomials - multiple signal processing - Several criteria (AIC, BIC, ...
关于多项式的Hadamard幂的一个猜想,王毅,张滨,设f(x)=∑ i=0^n aix^i是一个n次正系数多项式,它的p次Hadamard幂是多项式f^[p](x)=∑ i=0^n a i^px^i.一个长期没解决的猜想是:设p>1,若多项式f(x)仅�
介绍正交多项式及逼近论的知识,从三角多项式和代数多项式两个方面介绍。
大多项式算术大型多项式的算术
一种计算$GF(2)$上指数为梅森素数的不可约多项式的方法,王剑涛,郑东,本文描述了模$2^n-1$的剩余的群结构。当$2^n-1$为素数时,该群为循环群。元素$ lpha$的迹的计算可由此群的结构进行化简。利用迹函数的置��
Almost any cryptographic scheme can be ...when applied to random polynomials of degree d over n secret variables whenever the number m of public variables exceeds d + logdn. Their complexity is 2d
This book tells how Euler introduced the idea of orthogonal polynomials and combined the two subjects, and how Brouncker's formula of 1655 can be derived from Euler's efforts in Special Functions and...
求解二阶多项式我们所有人都必须至少求解一次二次方程式,但是也许自动进行某些操作会更方便。 我的程序就是为那些懒惰的人编写的。 解决这类多项式方程的数学原理: :
多项式矩阵的最小多项式的快速算法,于波,徐艳艳,本文给出计算多项式矩阵的最小多项式的一个快速算法. 它由低到高逐项确定最小多项式的系数多项式. 通过采用随机向量和随机原点位�
割圆多项式的正规分解,武跟强,李研超,本文首先研究整数q模整数m的阶,接着研究了m次割圆多项式在域K上的分解。通过对整数m的素数幂分解,我们对q模m的阶进行了深入的研�