1009. Product of Polynomials (25)
#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)的更多相关文章
- 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 ...
- 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 ...
- pat 甲级 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- PATA 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- 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 ...
- 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 ...
- 【PAT】1009. Product of Polynomials (25)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1009 分析:简单题.相乘时指数相加,系数相乘即可,输出时按指数从高到低的顺序.注意点:多项式相 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- jquery ajax 后台和前台数据交互 C#
<input type="button" id="updateInfo" value="更改货载重量" /> <div i ...
- QP:price list 安全性设置
1.添加职责 ORACLE PRICING ADMINISTRATOR 职责 (定价系统管理员) 2.Oracle Pricing Administrator Setup > Security ...
- Sublime Text 2 实用快捷键[Mac OS X]
lucasfais 总结了一些非常实用的 Sublime Text 2 快捷键,Lucifr 将它们翻译成了中文,以方便查阅. 注意:修饰键(如⌘)后跟多个按键的情况表示在按住修饰键的情况下依次按下相 ...
- java笔记01-反射
--2013年7月26日17:56:35 写文章之前,参考了这篇:http://www.cnblogs.com/Quincy/archive/2011/06/19/2084557.html 评价:这个 ...
- 去掉VC2010 编辑器里出现的红色波浪线
在VC2010中浏览代码的时候就大片的红线看着不舒服 其实不关VS的事,原因在于visual assist. 在VAssistX菜单栏->Visual Assist X Options-&g ...
- poj 1469 二分图最大匹配
就是最简单的最大匹配,没的说 #include<iostream> #include<cstdio> #include<cstring> #include<a ...
- 用Activator.CreateInstance代替new实现类的实例化(转)
一直想得到这样一个函数,输入一个类的名称为参数,返回一个相应的类的实例. 这在工厂模式中是非常有用的 这样,可以使程序有更高的扩展性,例如,,下面的例子 如果现在有一个类,专门用来计算交通工具的速度, ...
- Lombok(1.14.8) - @NoArgsConstructor, @RequiredArgsConstructor & @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor,提供一个无参的构造方法. package com.huey.hello.bean; import java.util.Dat ...
- 浅谈Oracle 性能优化
基于大型Oracle数据库应用开发已有6个年头了,经历了从最初零数据演变到目前上亿级的数据存储.在这个经历中,遇到各种各样的性能问题及各种性能优化. 在这里主要给大家分享一下数据库性能优化的一些方法和 ...
- HDOJ2027统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...