简单模拟。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std; double a[],b[],c[];
int k; int main()
{
for(int i=;i<=;i++) a[i]=b[i]=c[i]=;
int Max=-;
scanf("%d",&k);
for(int i=;i<=k;i++)
{
int id;double num;
scanf("%d%lf",&id,&num);
a[id]=num;
} scanf("%d",&k);
for(int i=;i<=k;i++)
{
int id;double num;
scanf("%d%lf",&id,&num);
b[id]=num;
} for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
c[i+j]+=a[i]*b[j];
}
} int cnt=;
for(int i=;i>=;i--)
if(c[i]!=) cnt++; printf("%d",cnt);
int op=;
for(int i=;i>=;i--)
if(c[i]!=)
printf(" %d %.1lf",i,c[i]);
return ;
}

PAT (Advanced Level) 1009. Product of Polynomials (25)的更多相关文章

  1. PTA (Advanced Level) 1009 Product of Polynomials

    1009 Product of Polynomials This time, you are supposed to find A×B where A and B are two polynomial ...

  2. 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 ...

  3. 【PAT甲级】1009 Product of Polynomials (25 分)

    题意: 给出两个多项式,计算两个多项式的积,并以指数从大到小输出多项式的指数个数,指数和系数. trick: 这道题数据未知,导致测试的时候发现不了问题所在. 用set统计非零项时,通过set.siz ...

  4. 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 ...

  5. 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 ...

  6. pat 甲级 1009. Product of Polynomials (25)

    1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  7. PATA 1009. Product of Polynomials (25)

    1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. PHP图形处理函数试题

    一.问答题 1.取得当前安装的 GD 库的信息的函数是? 2.取得图像大小的函数是? 3.为一幅图像分配颜色 + alpha的函数是? 4.新建一个基于调色板的图像的函数是? 5.新建一个黑色图像的函 ...

  2. Qt学习之系列[9] – QCoreApplication:processEvents()可能会引起递归,导致栈溢出崩溃

    api含义:QCoreApplication::processEvents() 将处理所有事件队列中的事件并返回给调用者. 问题描述: 当主线程在某个槽函数里正在执行processEvents时, 刚 ...

  3. cordova sqlite

    jar包在这里下载 https://github.com/litehelpers/Cordova-sqlite-storage 把SQLitePlugin 复制到自己工程目录 org.pgsqlite ...

  4. android cordova h5总结

    最近项目 替换页面  把80%页面替换成h5了. 首页h5页面可以放在android本地.增加访问速度.节省用户流量 把服务器上的  js代码 压缩成zip格式  放在asset目录.当应用安装时候 ...

  5. 转 sort按照数据大小排序

    一般默认的sort都是按照字母的ASCII进行排序的,现在想按照数字的大小进行排序 这里有一个文件test,内容为: 8723    23423 321324  213432 23      234 ...

  6. 【dp】 比较经典的dp poj 1160

    转自http://blog.sina.com.cn/s/blog_5dd8fece0100rq7d.html [题目大意]:用数轴描述一条高速公路,有V个村庄,每一个村庄坐落在数轴的某个点上,需要选择 ...

  7. JUST SORT

    We define B is a Divisor of one number A if A is divisible by B. So, the divisors of 12 are 1, 2, 3, ...

  8. toad执行存储过程

    选中存储过程,右键执行,根据存储过程中的sql语句,输入参数, 执行结果的out值点击connection output,鼠标放在statement标签,就会显示下边的out值. 在db2cmd下执行 ...

  9. lucene-SpanQuery跨度查询基础

    1.跨度查询SpanQuery5个子类 SpanQuery类型                            描述 SpanTermQuery                和其他跨度查询结合 ...

  10. java 数组流

    Example10_10.java import java.io.*; public class Example10_10 { public static void main(String args[ ...