简单模拟。

#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. MVC验证生成的代码

  2. nextSibling,previousSibling,childNodes常见错误

    在使用nextSibling与previousSibling时,常出现选不到预计对象的情况 eg: <div class="a">1</div> <d ...

  3. WampServer 下载以及安装问题

    WampServer 3.0 下载: http://dl.pconline.com.cn/download/52877-1.html 碰到的问题DDL无法添加,解决方法: http://jingyan ...

  4. Dominating Patterns

    Dominating Patterns Time Limit:3000MS   Memory Limit:Unknown   64bit IO Format:%lld & %llu Descr ...

  5. WPF 常用样式

    TextBox <Window x:Class="WpfDemo.ListBoxTemaple" xmlns="http://schemas.microsoft.c ...

  6. FZU 2113 BCD Code 数位dp

    数位dp,但是很奇怪的是我在虚拟oj上用GUC C++提交会wa,用Visual c++提交正确,但是加上注释后提交又莫名CE--好任性啊 0 ,0 题目思路:看代码吧 注释很详细 #include& ...

  7. UVA 11992 线段树

    input r c m      r<=20,1<=m<=20000 m行操作 1 x1 y1 x2 y2 v       add v 2 x1 y1 x2 y2 v       s ...

  8. 实测switch支持的参数类型

    @Test public void testSwitch() { switch (2) { case 1: System.out.println("int型:" + 1); bre ...

  9. iOS 开发之照片框架详解之二 —— PhotoKit 详解(上)

    转载自:http://kayosite.com/ios-development-and-detail-of-photo-framework-part-two.html 一. 概况 本文接着 iOS 开 ...

  10. Android手机图片适配问题

    需求:今天在做ListView的时候遇到一个问题,就是ListView中加载图片的时候.有些图片的大小比较大,所以会出现图片显示不充分的问题. 首先,再不做任何处理的情况下,大小是这样的.宽度是Wra ...