#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. C#加密算法汇总(转载)http://www.cnblogs.com/zengxiangzhan/archive/2010/01/30/1659687.html

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 方法一:     //须添加对System.Web的引用    ...

  2. ASP.NET MVC and jqGrid 学习笔记 6-增删改操作

    程序结构: Member.cs CRUD.cshtml CRUD.js HomeController 一.Model public class Member { [Key] public int No ...

  3. Java中的文件操作

    在使用计算机编程中,常常会用到对于文件的操作,以下是我对于Java中文件的相关内容学习之后的一个总结和在学习过程中遇到的一些问题. 一.什么是文件 对于文件进行操作,首先我们要知道什么是文件.在此之前 ...

  4. NSURLConnection、NSURLSession

    NSURLConnection   1.准备网络资源地址:URL 注意:由于URL支持26个英文字母,数字和少数的几个特殊字符. 因此对于URL中包含非标准URL的字符,需要进行编码. iOS提供了函 ...

  5. 转: android studio 消除SDK更新时的“https://dl-ssl.google.com refused”错误

    消除了: hostname in certificate didn't match: 转: http://blog.csdn.net/gaojinshan/article/details/987160 ...

  6. div a 和 div > a 的区别———后者指作用到div下一级的 a 标签 ,仅一级

    div a 和 div > a 的区别---后者指作用到div下一级的 a 标签 ,仅一级 如: <div> <a href="#">可以作用到< ...

  7. Nginx - Core Module Directives

    The following is the list of directives made available by the Core module. Most of these directives ...

  8. 搭建私有git代码托管服务就是这么简单(简单5步)

    部署一个git代码托管服务就是这么简单 --基于阿里云ecs以docker容器运行gogs代码托管服务 部署步骤: 1.新建ecs云主机,选定操作系统为ubuntu 12.4tls 2.搭建docke ...

  9. 刷机nexus4

    官方rom下载地址:https://developers.google.com/android/nexus/images?hl=zh-CN 刷机教程:http://jingyan.baidu.com/ ...

  10. 实例介绍Cocos2d-x中Box2D物理引擎:使用关节

    下面我们将使用Box2D物理引擎技术进行重构.使得关节能够掌握如何在Box2D使用关节约束.HelloWorldScene.cpp中与使用关节的相关代码如下: void HelloWorld::add ...