#include<iostream>
using namespace std;
struct {
int a;
double b;
}poly[1001];
double a[2001];//至少2000个位置
int main(){
int n,m,cnt=0,aa;
double bb;
cin>>n;
for(int i=0;i<n;i++){
cin>>poly[i].a>>poly[i].b;
}
cin>>m;
for(int i=0;i<m;i++){
int aa;
double bb;
cin>>aa>>bb;
for(int j=0;j<n;j++){
a[poly[j].a+aa]+=poly[j].b*bb; //这句蛮灵性的 ,仅此
}
}
for(int i=0;i<=2000;i++)
if(a[i]!=0)cnt++;
cout<<cnt;
for(int i=2000;i>=0;i--){
if(a[i]!=0){
printf(" %d %.1f",i,a[i]);
}
}
}

  

1009 Product of Polynomials (25分) 晚上脑子就是容易僵住的更多相关文章

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

  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: E ...

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

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

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

  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) 2016-09-09 23:02 96人阅读 评论(0) 收藏

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

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

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

  8. PATA 1009. Product of Polynomials (25)

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

  9. 【PAT】1009. Product of Polynomials (25)

    题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1009 分析:简单题.相乘时指数相加,系数相乘即可,输出时按指数从高到低的顺序.注意点:多项式相 ...

随机推荐

  1. centos 安装启动配置Jenkins

    一.Jenkins的安装 1.前提条件:已经成功安装了OPENJDK,因为jenkins是一款基于Java的持续集成工具. 安装OPENJDK的链接请参见我的另一篇博客: 安装连接:https://w ...

  2. Object 中的默认方法

    1.public final native Class<?> getClass() getClass方法,返回该实例的java.lang.Class类,例如 Object obj = ne ...

  3. MySql:使用Navicat定时备份数据库

    Navicat自带就有备份  还可以直接计划任务,很方便. 1. 新建计划 打开navicat客户端,连上mysql后,双击左边你想要备份的数据库.点击"计划",再点击" ...

  4. [转]CURL常用命令

    From:http://www.cnblogs.com/gbyukg/p/3326825.html p.p1 { margin: 0 0 2px; font: 14px ".PingFang ...

  5. WPF教程五:附加依赖项属性

    附加依赖项属性是一个属性本来不属于对象自己,但是某些特定场景其他的对象要使用该对象在这种场景下的值.这个值只在这个场景下使用.基于这个需求设计出来的属性.这里主要涉及到一个解耦问题.最大的优势是在特定 ...

  6. ARTS第五周

    -第五周.这两周在复习大学里的课程,发现当时觉得课上很多看不懂的,现在看起来轻松多了,也带来了新的感悟. 1.Algorithm:每周至少做一个 leetcode 的算法题2.Review:阅读并点评 ...

  7. sqlplus 删除^H处理

    1.在oracle用户下更改 2.在".profile"或者"~/.bash_profile"添加 stty erase ^H 3.wq,保存退出 stty时一 ...

  8. Python基础4--数据类型

    一.数据类型是什么鬼? 计算机顾名思义就是可以做数学计算的机器,因此,计算机程序理所当然地可以处理各种数值.但是,计算机能处理的远不止数值,还可以处理文本.图形.音频.视频.网页等各种各样的数据,不同 ...

  9. 「CF1380G」 Circular Dungeon

    CF1380G Circular Dungeon 看懂样例就能做. 虽然我瞪了 20 分钟 菜是原罪 首先可以将从每一个点出发所能获得的价值相加,再除以 \(n\) 就可以得到价值的期望. 所以问题转 ...

  10. Spring boot+Mybatis+MySQL插入中文乱码

    转载:https://www.jianshu.com/p/bd0311a33c16 现象: 搭建spring boot+mybatis+mysql时出现插入mysql的中文出现乱码???.   mys ...