简单模拟。

#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. 注意题目条件!!! 团问题 HDU 5952

    题目大意:团的定义就是,团内的所有点,两两之间各有一条边,团的大小就是点的个数.现给你一个n个点,m条边的图.问,该图中有多少点的个数为s的团. (题目保证每个点的度数不超过20,n<=100, ...

  2. 使用HAXM加速Android虚拟机

    Android虚拟机在支持Intel VT技术的CPU上,可以使用HAXM(Hardware Accelerated Execution Manager)得到硬件加速支持,使得虚拟机运行速度得到极大提 ...

  3. Spring中实现监听的方法

    在未使用框架进行编程的时候,我们常常在web.xml中加上这样一段话 <listener> <listener-class>XXX</listener-class> ...

  4. mybatis 的一点问题

    写法1:   public User queryUserByUsername(String username); 写法2:   public User queryUserByUsername(@Par ...

  5. ios开发使用lipo命令合并真机库和模拟器库

    在开发ios时,我们经常会遇到编译两套库文件,使用模拟器时链接模拟器库,使用真机时使用真机库,这样操作会对后期的维护带来麻烦,所以Apple提供了一个把多个不同平台的.a库文件合并成一个适用于多平台的 ...

  6. Coupons and Discounts

    Coupons and Discounts time limit per test 1 second memory limit per test 256 megabytes input standar ...

  7. Opencv基础知识-----视频的读取和操作

    Opencv读取视频代码 #include "stdafx.h" #include"highgui.h"   int main(int argc,char* a ...

  8. LA 4329 BIT 分治

    #include <cstdio> #include <queue> #include <cstring> #include <iostream> #i ...

  9. c++模板两个数的加法

    1.最简单的情况: template<class T> T Add(const T& a, const T& b) { return a + b; } 缺点是不能够处理不同 ...

  10. 在win7/8/10鼠标右键添加带管理员权限的“在此处打开命令窗口”

    Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Drive\shell\runas]@="@shell32.dll,-8506 ...