1009. Product of Polynomials (25)
#include <stdio.h> struct MyStruct
{
int exp;
double coe;
}; int main()
{
int k1,k2,i,j;
MyStruct ans1[],ans2[];
double dans[]; //两个 最高幂相乘 , 最高幂为2000
while(scanf("%d",&k1)!=EOF)
{
for(i=;i<=;i++)
dans[i]=0.0;
for(i=;i<k1;i++)
scanf("%d%lf",&ans1[i].exp,&ans1[i].coe);
getchar();
scanf("%d",&k2);
for(i=;i<k2;i++)
scanf("%d%lf",&ans2[i].exp,&ans2[i].coe);
int count=;
for(i=;i<k1;i++)
for(j=;j<k2;j++)
{
if(dans[ans1[i].exp+ans2[j].exp]==0.0) ++count;
dans[ans1[i].exp+ans2[j].exp]+=(ans1[i].coe * ans2[j].coe);
if(dans[ans1[i].exp+ans2[j].exp]==0.0) --count;
} printf("%d",count);
for(i=;i>=;i--)
if(dans[i]!=0.0)
printf(" %d %0.1lf",i,dans[i]);
printf("\n");
}
return ;
}
1009. Product of Polynomials (25)的更多相关文章
- PAT甲 1009. Product of Polynomials (25) 2016-09-09 23:02 96人阅读 评论(0) 收藏
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- PAT 甲级 1009 Product of Polynomials (25)(25 分)(坑比较多,a可能很大,a也有可能是负数,回头再看看)
1009 Product of Polynomials (25)(25 分) This time, you are supposed to find A*B where A and B are two ...
- pat 甲级 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- PATA 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- 1009 Product of Polynomials (25分) 多项式乘法
1009 Product of Polynomials (25分) This time, you are supposed to find A×B where A and B are two po ...
- PAT 1009 Product of Polynomials (25分) 指数做数组下标,系数做值
题目 This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: E ...
- 【PAT】1009. Product of Polynomials (25)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1009 分析:简单题.相乘时指数相加,系数相乘即可,输出时按指数从高到低的顺序.注意点:多项式相 ...
- PAT 解题报告 1009. Product of Polynomials (25)
This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each ...
- 1009 Product of Polynomials (25)(25 point(s))
problem This time, you are supposed to find A*B where A and B are two polynomials. Input Specificati ...
- PAT Advanced 1009 Product of Polynomials (25 分)(vector删除元素用的是erase)
This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: Each ...
随机推荐
- Customer reviews on Lexia3 V48 diagnostic tool in EOBD2.FR
Robert said: Ok, so I bought a Lexia3 interface from EOBD2.FR in 2010. I have had no issues over the ...
- TCP/IP与UDP区别
最近面试,问到这方面的问题,这里总结一下: TCP (Transmission Control Protocol 传输控制协议):面向连接的,不可靠的,数据流服务.UDP (User Dat ...
- 24小时学通Linux内核之如何处理输入输出操作
真的是悲喜交加呀,本来这个寒假早上8点都去练车,两个小时之后再来实验室陪伴Linux内核,但是今天教练说没名额考试了,好纠结,不过想想就可以睡懒觉了,哈哈,自从大三寒假以来还没睡过懒觉呢,现在也有更多 ...
- 【组合数的唯一分解定理】Uva1635
给出n.m,求得最终求和数列an=C(n-1,0)*x1 + C(n-1,1)*x2+...+C(n-1,n-1)*xn; 若xi与m无关,则an除以m的余数与xi无关,即余数不含xi的项: 输入:n ...
- poj 3250 栈应用
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #d ...
- HDOJ2021发工资咯:)
发工资咯:) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
- 每天一道LeetCode--169.Majority Elemen
Given an array of size n, find the majority element. The majority element is the element that appear ...
- usp_Copy_Unzip_DirFiles -- 拷贝,解压,列出文件名 from FTP Folder to Work Folder
CREATE PROC usp_Copy_Unzip_DirFiles @FTPPath NVARCHAR(4000)= '', -- ftp 文件夹路径 @WorkPath NVARCHAR(400 ...
- [C#]Winform下回车或Tab键自动切换下一个控件焦点
满足用户体验,在数据录入时,能在输入完一个信息后通过回车或Tab键自动的切换到下一个控件(字段). 在界面控件设计时,默认可以通过设置控件的TabIndex来实现.但在布局调整时或者是对输入的内容有选 ...
- Quartz2D 图像处理
首先感谢一片枫叶总结出这么好的文章,文章出处:http://www.cnblogs.com/smileEvday/archive/2013/05/25/IOSImageEdit.html 本文将为大家 ...