#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)的更多相关文章

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

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

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

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

  4. PATA 1009. Product of Polynomials (25)

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

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

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

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

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

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

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

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

随机推荐

  1. jetty-distribution-7.6.x 部署

    (1)启动 jetty 命令:java - jar start.jar 需要注意2个事项:必须使用JDK来运行jetty:启动是需要读取 start.ini 的配置信息. (2)第一个注意事项只要保证 ...

  2. hadoop学习记录(三)HBase基本概念

    这一次开始学习HBase数据库. 我用的是VMWare + ubuntu16.04 +Hbase1.1.5 +hadoop2.6.0的组合. 经过亲自安装验证,版本间没有发生冲突,可以进行学习和开发. ...

  3. android-ramdisk.img分析、recovery.img&boot.img执行过程

    转载请注明来源:cuixiaolei的技术博客 一.ramdisk介绍 ramdisk通过直面意思就大概能理解意思,ram disk虚拟内存盘,将ram模拟成硬盘来使用的文件系统.对于传统的磁盘文件系 ...

  4. c语言排序算法总结

    一.希尔(Shell)排序法 /* Shell 排序法 */ #include <stdio.h> void sort(int v[],int n) {      int gap,i,j, ...

  5. agile学习

    https://www.flickr.com/photos/codingthearchitecture/sets/

  6. Java 正则表达式漏洞

    由于工作原因,一直没有时间把在线上遇到的问题总结一下.还好,今天我来了. 废话少说了. 主要说一下“java 正则表达式中的一个漏洞”,详细问题描述 http://bugs.sun.com/bugda ...

  7. poj 3249 拓扑排序 and 动态规划

    思路:我们首先来一遍拓扑排序,将点按先后顺序排列于一维数组中,然后扫描一遍数组,将每个点的出边所连接的点进行更新,即可得到最优解. #include<iostream> #include& ...

  8. 转: android编译过程(流程图)

  9. 转: 基于nginx的hls直播系统

    转自:http://blog.csdn.net/cjsafty/article/details/9108587 看点: 1. 详细解解答了 nginx rtmp配置过程. 前写了一篇基于nginx的h ...

  10. less-2

    样式内嵌: 生成css:   样式运算:   生成的css文件: